/* =========================================================
   Design tokens
   ========================================================= */
:root {
  --bg: #ffffff;
  --bg-alt: #f7f8fa;
  --surface: #ffffff;
  --text: #111827;
  --text-muted: #5b6474;
  --border: #e5e7eb;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --accent-2: #06b6d4;
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 8px 24px rgba(17, 24, 39, .06);
  --shadow-hover: 0 2px 4px rgba(17, 24, 39, .06), 0 20px 40px rgba(79, 70, 229, .14);
  --radius: 16px;
  --radius-sm: 10px;
  --header-h: 64px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d12;
    --bg-alt: #11141b;
    --surface: #151922;
    --text: #e8eaf0;
    --text-muted: #9aa3b2;
    --border: #252a36;
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-soft: rgba(129, 140, 248, .12);
    --accent-2: #22d3ee;
    --success: #34d399;
    --danger: #f87171;
    --warning: #fbbf24;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, .3), 0 20px 40px rgba(129, 140, 248, .18);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b0d12;
  --bg-alt: #11141b;
  --surface: #151922;
  --text: #e8eaf0;
  --text-muted: #9aa3b2;
  --border: #252a36;
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-soft: rgba(129, 140, 248, .12);
  --accent-2: #22d3ee;
  --success: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, .3), 0 20px 40px rgba(129, 140, 248, .18);
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  word-break: keep-all;
  overflow-wrap: break-word;
  transition: background-color .3s ease, color .3s ease;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, p { margin: 0; }
code {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .88em;
  padding: .1em .4em;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
}

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

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 100;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  transition: top .2s;
}
.skip-link:focus { top: 12px; }

/* =========================================================
   Header
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background-color .3s;
}
.site-header.scrolled { border-bottom-color: var(--border); }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.logo span { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 4px;
}
.nav-links a {
  position: relative;
  display: block;
  padding: 6px 14px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 8px;
  transition: color .2s;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s var(--ease);
}
.nav-links a:hover,
.nav-links a.active { color: var(--text); }
.nav-links a:hover::after,
.nav-links a.active::after { transform: scaleX(1); }

.nav-actions { display: flex; align-items: center; gap: 4px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background-color .2s;
}
.icon-btn:hover { background: var(--accent-soft); }
.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 현재 테마에 따라 아이콘 전환 */
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

.menu-btn { display: none; flex-direction: column; align-items: center; justify-content: center; gap: 5px; }
.menu-btn span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform .3s var(--ease), opacity .2s;
}
.menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.scroll-progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transform-origin: left;
}

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 24px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .2s, background-color .2s, border-color .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn-primary:hover { background: var(--accent-hover); }
:root[data-theme="dark"] .btn-primary { color: #0b0d12; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-primary { color: #0b0d12; }
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn[disabled] { opacity: .7; cursor: wait; transform: none; }

.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================
   Hero
   ========================================================= */
.hero {
  position: relative;
  min-height: calc(100svh - var(--header-h));
  display: flex;
  align-items: center;
  padding: 80px 0 120px;
  overflow: hidden;
}

.hero-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .45;
  animation: float 18s ease-in-out infinite;
}
.blob-1 {
  width: 480px; height: 480px;
  top: -120px; right: -80px;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
}
.blob-2 {
  width: 380px; height: 380px;
  bottom: -100px; left: -100px;
  background: radial-gradient(circle, var(--accent-2) 0%, transparent 70%);
  animation-delay: -9s;
  opacity: .3;
}
.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at center, #000 10%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 10%, transparent 70%);
  opacity: .5;
}
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-40px, 30px) scale(1.06); }
  66% { transform: translate(30px, -20px) scale(.95); }
}

.hero-greeting {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 16px;
}
.hero-title {
  font-size: clamp(36px, 6vw, 64px);
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -.03em;
  margin-bottom: 24px;
}
.accent {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.typing { color: var(--text-muted); font-weight: 700; }
.caret {
  display: inline-block;
  width: 3px;
  height: .9em;
  margin-left: 4px;
  vertical-align: -0.08em;
  background: var(--accent);
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-desc {
  max-width: 600px;
  font-size: 18px;
  color: var(--text-muted);
  margin-bottom: 36px;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 40px; }
.hero-social { display: flex; gap: 24px; }
.hero-social a {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color .2s;
}
.hero-social a:hover { color: var(--accent); }

.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 32px;
  width: 26px;
  height: 42px;
  margin-left: -13px;
  border: 2px solid var(--border);
  border-radius: 14px;
}
.scroll-hint span {
  position: absolute;
  left: 50%;
  top: 8px;
  width: 4px;
  height: 8px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--accent);
  animation: scroll-dot 2s ease-in-out infinite;
}
@keyframes scroll-dot {
  0% { transform: translateY(0); opacity: 1; }
  80% { transform: translateY(14px); opacity: 0; }
  100% { opacity: 0; }
}

/* =========================================================
   Sections
   ========================================================= */
.section { padding: 112px 0; }
.section-alt { background: var(--bg-alt); }

.section-title {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 40px;
}
.section-title .num {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
}
.section-lead {
  max-width: 680px;
  margin: -16px 0 32px;
  color: var(--text-muted);
}

.section-title small {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0;
}
.text-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  text-underline-offset: 3px;
}
.text-link:hover { text-decoration-color: var(--accent); }

/* About */
.about-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 56px;
  align-items: start;
}
.profile {
  margin: 0;
  border-radius: 20px;
  overflow: hidden;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  aspect-ratio: 3 / 4;
}
.profile img { width: 100%; height: 100%; object-fit: cover; }
.about-body { display: flex; flex-direction: column; gap: 28px; }

.callout {
  margin: 0;
  padding: 20px 24px;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--accent-soft);
  font-size: 18px;
}
.callout strong { color: var(--accent); }

.info { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; margin: 0; }
.info div { display: flex; flex-direction: column; }
.info dt {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.info dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.info a:hover { color: var(--accent); }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.stats li {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform .3s var(--ease), border-color .3s;
}
.stats li:hover { transform: translateY(-4px); border-color: var(--accent); }
.stats strong {
  display: block;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.3;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.stats span { font-size: 14px; line-height: 1.4; color: var(--text-muted); }

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.skill-card {
  padding: 24px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color .3s, transform .3s var(--ease);
}
.skill-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.skill-card h3 { font-size: 16px; margin-bottom: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips li {
  padding: 4px 12px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

/* Experience */
.job {
  padding: 32px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.job-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 24px;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.job-head h3 { font-size: 22px; letter-spacing: -.01em; }
.job-role { color: var(--text-muted); font-weight: 500; }
.job-period {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 50%, transparent);
  animation: live 2s ease-out infinite;
}
@keyframes live {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 50%, transparent); }
  100% { box-shadow: 0 0 0 10px transparent; }
}
.job-list { display: grid; gap: 10px; }
.job-list li {
  position: relative;
  padding-left: 22px;
  color: var(--text-muted);
}
.job-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: .72em;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--accent);
  transform: rotate(45deg);
}
.job-list strong { color: var(--text); }

/* Troubleshooting */
.cases { display: grid; gap: 20px; }
.case {
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: box-shadow .35s var(--ease), border-color .35s;
}
.case:hover { box-shadow: var(--shadow-hover); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.case-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--border);
}
.case-no {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
}
:root[data-theme="dark"] .case-no { color: #0b0d12; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .case-no { color: #0b0d12; }
}
.case-head h3 { flex: 1; min-width: 0; font-size: 19px; letter-spacing: -.01em; }
.case-result-badge {
  font-size: 13px;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 999px;
  color: var(--success);
  background: color-mix(in srgb, var(--success) 12%, transparent);
}
.case-body { margin: 0; padding: 8px 28px 20px; }
.case-body div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
}
.case-body div:last-child { border-bottom: 0; }
.case-body dt { font-size: 14px; font-weight: 700; color: var(--text-muted); padding-top: 2px; }
.case-body dd { margin: 0; }
.case-body .is-result dt { color: var(--success); }
.case-body strong { color: var(--accent); }

/* Projects */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.filter-btn {
  padding: 8px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
:root[data-theme="dark"] .filter-btn[aria-pressed="true"] { color: #0b0d12; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .filter-btn[aria-pressed="true"] { color: #0b0d12; }
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 320px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s;
  animation: card-in .5s var(--ease) both;
}
.project-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.project-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
  cursor: zoom-in;
  overflow: hidden;
}
.project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform .6s var(--ease);
}
.project-card:hover .project-thumb img { transform: scale(1.04); }
.thumb-count {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  background: rgba(17, 24, 39, .72);
  color: #fff;
}

.project-body { display: flex; flex-direction: column; flex: 1; padding: 24px 28px 28px; }
.project-card h3 { font-size: 21px; line-height: 1.35; letter-spacing: -.01em; }
.project-subtitle { margin-top: 2px; color: var(--text-muted); font-weight: 500; }
.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 14px 0;
  font-size: 13px;
  color: var(--text-muted);
}
.project-meta span { display: inline-flex; gap: 6px; }
.project-meta b { color: var(--text); font-weight: 600; }
.project-summary { font-size: 15px; margin-bottom: 12px; }
.project-highlights { display: grid; align-content: start; gap: 6px; margin-bottom: 18px; flex: 1; }
.project-highlights li {
  position: relative;
  padding-left: 16px;
  font-size: 14px;
  color: var(--text-muted);
}
.project-highlights li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .7em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags li {
  padding: 2px 10px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.project-links { display: flex; gap: 16px; margin-top: 16px; }
.project-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
}
.project-links a .arrow { transition: transform .2s var(--ease); }
.project-links a:hover .arrow { transform: translateX(4px); }

.skeleton {
  background: linear-gradient(90deg, var(--bg-alt) 25%, var(--border) 50%, var(--bg-alt) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  box-shadow: none;
}
.skeleton:hover { transform: none; box-shadow: none; }
@keyframes shimmer { to { background-position: -200% 0; } }

.empty { color: var(--text-muted); grid-column: 1 / -1; }

/* Lightbox */
.lightbox {
  width: min(1000px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
  overflow: hidden;
}
.lightbox[open] { display: flex; flex-direction: column; animation: pop .3s var(--ease); }
.lightbox::backdrop { background: rgba(8, 10, 15, .7); backdrop-filter: blur(4px); }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.lightbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 12px 24px;
  border-bottom: 1px solid var(--border);
}
.lightbox-title { font-weight: 700; }
.lightbox-body { overflow-y: auto; padding: 24px; display: grid; gap: 28px; }
.lightbox-body figure { margin: 0; }
.lightbox-body img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
}
.lightbox-body figcaption { margin-top: 8px; font-size: 14px; color: var(--text-muted); text-align: center; }

/* Timeline */
.timeline { position: relative; padding-left: 32px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 40px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -32px;
  top: 8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-alt);
  border: 3px solid var(--accent);
}
.timeline-item time {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.timeline-item h3 { font-size: 20px; margin: 4px 0 8px; }
.timeline-item p { color: var(--text-muted); max-width: 680px; }

/* Contact */
.contact-wrap { max-width: 760px; }
.contact-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 32px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field-full { grid-column: 1 / -1; }
.field label { font-size: 14px; font-weight: 600; }
.field input,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .2s, box-shadow .2s;
}
.field textarea { resize: vertical; min-height: 140px; }
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.field.invalid input,
.field.invalid textarea { border-color: var(--danger); }
.field-error { min-height: 1.2em; font-size: 13px; color: var(--danger); }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.form-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.form-status { font-size: 15px; font-weight: 500; }
.form-status.success { color: var(--success); }
.form-status.error { color: var(--danger); }
.form-status.info { color: var(--text-muted); }

/* Footer */
.site-footer {
  padding: 32px 0;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-muted);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.api-status { display: inline-flex; align-items: center; gap: 8px; }
.api-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
}
.api-status[data-state="online"] .dot { background: var(--success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 20%, transparent); }
.api-status[data-state="offline"] .dot { background: var(--text-muted); }
.api-status[data-state="checking"] .dot { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.visits:not(:empty)::before { content: "·"; margin-right: 8px; }

/* =========================================================
   Scroll reveal animation
   ========================================================= */
.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .8s var(--ease), transform .8s var(--ease);
  transition-delay: var(--delay, 0s);
}
.js .reveal.visible { opacity: 1; transform: none; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1000px) {
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .menu-btn { display: flex; }
  .nav-links {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 8px 16px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: transform .3s var(--ease), opacity .3s, visibility .3s;
  }
  .nav-links.open { transform: none; opacity: 1; visibility: visible; }
  .nav-links a { padding: 12px 8px; font-size: 16px; }
  .nav-links a::after { left: 8px; right: auto; width: 24px; }
}

@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; gap: 32px; }
  .profile { width: 200px; }
  .projects-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .container { padding: 0 16px; }
  .section { padding: 80px 0; }
  .hero { padding: 56px 0 100px; }
  .hero-desc { font-size: 16px; }
  .callout { font-size: 16px; padding: 16px 18px; }
  .info { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .job { padding: 22px; }
  .job-head h3 { font-size: 19px; }
  .case-head { padding: 18px 20px; }
  .case-body { padding: 4px 20px 14px; }
  .case-body div { grid-template-columns: 1fr; gap: 2px; }
  .contact-form { grid-template-columns: 1fr; padding: 20px; }
  .project-body { padding: 20px 20px 22px; }
  .project-card { min-height: 0; }
  .stats li { padding: 16px; }
  .stats strong { font-size: 26px; }
  .lightbox-body { padding: 16px; }
}

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