:root,
html[data-theme="light"] {
  --bg: #f4efe6;
  --bg-2: #fffaf2;
  --ink: #1b1714;
  --muted: #6b6258;
  --line: rgba(27, 23, 20, 0.1);
  --accent: #e85d04;
  --accent-2: #0f766e;
  --card: #fffdf8;
  --orb-a: #ffb703;
  --orb-b: #2a9d8f;
  --orb-c: #e63946;
  --header: rgba(244, 239, 230, 0.78);
  --shadow: 0 18px 40px rgba(27, 23, 20, 0.08);
  --max: 1120px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="dark"] {
  --bg: #0e1114;
  --bg-2: #161b20;
  --ink: #f3eee6;
  --muted: #a39a8e;
  --line: rgba(243, 238, 230, 0.12);
  --accent: #ff8a3d;
  --accent-2: #5eead4;
  --card: #1a2026;
  --orb-a: #f4a261;
  --orb-b: #2a9d8f;
  --orb-c: #e76f51;
  --header: rgba(14, 17, 20, 0.72);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Outfit, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.35s var(--ease), color 0.35s var(--ease);
}

img { max-width: 100%; display: block; }
a { color: inherit; }

.orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.45;
  animation: float 16s ease-in-out infinite;
}
.orb-a { width: 340px; height: 340px; background: var(--orb-a); top: -80px; right: 8%; }
.orb-b { width: 280px; height: 280px; background: var(--orb-b); top: 38%; left: -80px; animation-delay: -4s; }
.orb-c { width: 220px; height: 220px; background: var(--orb-c); bottom: 8%; right: 18%; animation-delay: -8s; opacity: 0.28; }
@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(20px, -28px, 0) scale(1.08); }
}

.site-header, main, .site-footer { position: relative; z-index: 1; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: var(--header);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: Syne, sans-serif;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-decoration: none;
  font-size: 1.05rem;
}
.logo img {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.nav-links { display: flex; gap: 22px; align-items: center; }
.nav-links a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}
.nav-links a:hover { color: var(--ink); }
.header-tools { display: flex; align-items: center; gap: 10px; }
.lang-switch {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  display: flex;
  overflow: hidden;
}
.lang-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 11px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
}
.lang-switch button.is-on {
  background: var(--ink);
  color: var(--bg);
}

.theme-switch {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}
.theme-switch-track {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  width: 58px;
  height: 32px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, #ffe8c2, #ffd6a5);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.45);
  transition: background 0.45s var(--ease), border-color 0.35s;
}
html[data-theme="dark"] .theme-switch-track {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35);
}
.theme-icon {
  display: grid;
  place-items: center;
  z-index: 1;
  width: 100%;
  height: 100%;
  color: #b45309;
  transition: opacity 0.35s, transform 0.45s var(--ease), color 0.35s;
}
.theme-icon svg { width: 14px; height: 14px; }
html[data-theme="dark"] .theme-icon { color: #fde68a; }
.theme-icon-sun { opacity: 1; transform: scale(1); }
.theme-icon-moon { opacity: 0.35; transform: scale(0.85); }
html[data-theme="dark"] .theme-icon-sun { opacity: 0.35; transform: scale(0.85); }
html[data-theme="dark"] .theme-icon-moon { opacity: 1; transform: scale(1); }
.theme-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 12px rgba(27, 23, 20, 0.22);
  transition: transform 0.45s var(--ease), background 0.35s;
}
html[data-theme="dark"] .theme-switch-thumb {
  transform: translateX(26px);
  background: #f8fafc;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}
.theme-switch:hover .theme-switch-thumb { transform: translateX(2px) scale(1.05); }
html[data-theme="dark"] .theme-switch:hover .theme-switch-thumb { transform: translateX(24px) scale(1.05); }
.theme-switch:active .theme-switch-thumb { width: 28px; }

.wrap { width: min(var(--max), calc(100% - 48px)); margin: 0 auto; }

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px 36px;
  align-items: center;
  padding: 64px 0 56px;
  min-height: auto;
}
.hero-copy h1 {
  font-family: Syne, sans-serif;
  font-size: clamp(2.6rem, 6vw, 5.2rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
  margin: 0 0 16px;
}
.hero-copy h1 .name-line {
  display: block;
}
.hero-role {
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  color: var(--accent);
  margin: 0 0 6px;
  font-weight: 650;
}
.hero-place { color: var(--muted); margin: 0 0 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 20px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.92rem;
  transition: transform 0.25s var(--ease), box-shadow 0.25s;
}
.btn:hover { transform: translateY(-3px) scale(1.02); }
.btn-solid { background: var(--accent); color: #fff; box-shadow: var(--shadow); }
.btn-ghost { border: 1px solid var(--line); color: var(--ink); background: var(--card); }

.hero-avatar {
  justify-self: end;
  position: relative;
  width: min(280px, 38vw);
  aspect-ratio: 1;
}
.avatar-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: conic-gradient(from 120deg, var(--accent), var(--accent-2), var(--orb-a), var(--accent));
  animation: spin 10s linear infinite;
}
.avatar-ring::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--bg);
}
.hero-avatar img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
  border-radius: 50%;
  box-shadow: var(--shadow);
}
@keyframes spin { to { transform: rotate(360deg); } }

.section { padding: 88px 0; border-top: 1px solid var(--line); }
.kicker {
  color: var(--accent-2);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  margin: 0 0 14px;
}
.lead { font-size: 1.22rem; max-width: 72ch; color: var(--ink); margin: 0; }

.skill-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 32px;
}
.skill-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
  transition: transform 0.3s var(--ease);
}
.skill-card:hover { transform: translateY(-6px) rotate(-0.4deg); }
.skill-card h3 { margin: 0 0 10px; font-size: 0.95rem; font-family: Syne, sans-serif; }
.skill-card p { margin: 0; color: var(--muted); font-size: 0.95rem; }

.skill-marquee {
  margin-top: 28px;
  overflow: hidden;
  padding-top: 6px;
  padding-bottom: 46px;
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.skill-marquee-track {
  display: flex;
  width: max-content;
  gap: 0;
  animation: marquee 32s linear infinite;
}
.skill-marquee:hover .skill-marquee-track { animation-play-state: paused; }
.skill-marquee-group {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding-right: 18px;
}
.skill-logo {
  position: relative;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  cursor: default;
  transition: transform 0.25s var(--ease), border-color 0.25s;
}
.skill-logo img {
  width: 28px;
  height: 28px;
}
.skill-logo em {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%) translateY(-4px);
  padding: 5px 9px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 650;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  box-shadow: var(--shadow);
  transition: opacity 0.2s, transform 0.2s var(--ease);
  z-index: 2;
}
.skill-logo em::after {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: var(--ink);
}
.skill-logo:hover {
  transform: scale(1.08);
  border-color: var(--accent);
}
.skill-logo:hover em {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.job {
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}
.job:last-child { border-bottom: 0; }
.job h3 {
  font-family: Syne, sans-serif;
  font-size: 1.35rem;
  margin: 0 0 6px;
  letter-spacing: -0.03em;
}
.job-meta { color: var(--muted); margin: 0 0 16px; font-size: 0.95rem; }
.job h4 { margin: 18px 0 8px; font-size: 0.92rem; color: var(--accent); }
.job ul { margin: 0; padding-left: 18px; }
.job li { margin-bottom: 8px; }
.edu-link { margin: 16px 0 0; }
.edu-link a {
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
}
.edu-link a:hover { text-decoration: underline; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 28px; }
.filters button {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.filters button.is-on {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  min-height: 100%;
  box-shadow: var(--shadow);
  transition: transform 0.35s var(--ease);
}
.card:hover { transform: translateY(-8px); }
.card.is-hidden { display: none; }
.card-media { aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg-2); }
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 0.6s var(--ease);
}
.card:hover .card-media img { transform: scale(1.06); }
.card-body { padding: 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body h3 { font-size: 1.05rem; }
.card-body p { font-size: 0.9rem; }
.card-tag { color: var(--accent-2); font-size: 0.78rem; letter-spacing: 0.04em; font-weight: 700; }
.card h3 { font-family: Syne, sans-serif; margin: 0; font-size: 1.25rem; letter-spacing: -0.03em; }
.card p { margin: 0; color: var(--muted); font-size: 0.95rem; flex: 1; }
.card-links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-size: 0.86rem; font-weight: 700; }
.card-links a { color: var(--ink); text-decoration: none; border-bottom: 2px solid var(--accent); }

.notes-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.note {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.note p { margin: 0 0 14px; }
.note strong { display: block; font-family: Syne, sans-serif; }
.note span { color: var(--muted); font-size: 0.88rem; }
.hint { color: var(--muted); margin: 0 0 22px; }

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 32px;
  margin-top: 20px;
}
.contact-grid dt { color: var(--muted); font-size: 0.82rem; }
.contact-grid dd { margin: 0 0 12px; }
.contact-grid a { color: var(--ink); }
.social-links {
  display: flex;
  align-items: center;
  gap: 12px;
}
.social-links a {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  transition: transform 0.25s var(--ease), border-color 0.25s, color 0.25s;
}
.social-links a:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  color: var(--accent);
}

.site-footer {
  padding: 28px 0 40px;
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--line);
}

.fab {
  position: fixed;
  z-index: 50;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.25s var(--ease), opacity 0.25s, background 0.25s, border-color 0.25s;
}
.fab[hidden] { display: none !important; }
.fab:hover {
  transform: translateY(-3px) scale(1.04);
  border-color: var(--accent);
  color: var(--accent);
}
.fab-top { right: 22px; bottom: 22px; }
.fab-docs {
  position: fixed;
  left: 22px;
  bottom: 22px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
.fab-docs[hidden] { display: none !important; }
.fab-file {
  position: static;
}
.fab-docs-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 148px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  transform-origin: bottom left;
  animation: fab-pop 0.28s var(--ease);
}
.fab-docs-menu[hidden] { display: none !important; }
.fab-docs-menu a {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--ink);
  background: transparent;
  transition: background 0.2s, color 0.2s;
}
.fab-docs-menu a:hover {
  background: var(--bg-2);
  color: var(--accent);
}
@keyframes fab-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 1100px) {
  .project-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; min-height: auto; padding: 48px 0; text-align: center; gap: 28px; }
  .hero-actions { justify-content: center; }
  .hero-avatar { order: -1; justify-self: center; width: min(220px, 64vw); }
  .skill-grid, .project-grid, .contact-grid { grid-template-columns: 1fr; }
  .nav-links { gap: 12px; flex-wrap: wrap; }
  .site-header { flex-wrap: wrap; }
  .fab-top { right: 16px; bottom: 16px; }
  .fab-docs { left: 16px; bottom: 16px; }
}

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