:root {
  --bg: #f1f8f5;
  --bg-2: #edf6f2;
  --surface: #ffffff;
  --text: #0e2230;
  --muted: #54707d;
  --line: #cfe2db;
  --primary: #0e8478;
  --primary-2: #119e90;
  --accent: #f97316;
  --shadow: 0 18px 40px rgba(14, 34, 48, 0.08);
  --radius: 16px;
  --radius-sm: 12px;
}

[data-theme="dark"] {
  --bg: #08161c;
  --bg-2: #0c1e25;
  --surface: #102733;
  --text: #e8f5f7;
  --muted: #a4c0cb;
  --line: #1f3d48;
  --primary: #22b8a8;
  --primary-2: #2ed0bf;
  --accent: #ff8b3d;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Outfit", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 12%, rgba(14, 132, 120, 0.16), transparent 35%),
    radial-gradient(circle at 92% 14%, rgba(249, 115, 22, 0.14), transparent 38%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  line-height: 1.6;
  overflow-x: hidden;
}

#bg-network {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0.75;
}

.container {
  width: min(1160px, calc(100% - 2.2rem));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid color-mix(in srgb, var(--primary) 16%, transparent);
}

.nav-wrap {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
}

.brand {
  text-decoration: none;
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand span {
  color: var(--primary);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.nav a {
  text-decoration: none;
  color: var(--muted);
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0.45rem 0.72rem;
  font-size: 0.84rem;
  font-weight: 600;
  transition: 180ms ease;
}

.nav a:hover,
.nav a.active {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 34%, transparent);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.nav-actions {
  display: flex;
  gap: 0.45rem;
}

.ghost-btn {
  border: 1px solid color-mix(in srgb, var(--primary) 28%, transparent);
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 10px;
  padding: 0.44rem 0.58rem;
  cursor: pointer;
}

.main {
  padding-top: 2.2rem;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.18;
}

h1,
h2 {
  font-family: "Space Grotesk", sans-serif;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 2rem;
  align-items: start;
}

.eyebrow {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  padding: 0.36rem 0.65rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--primary) 24%, transparent);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.hero h1 {
  margin-top: 0.9rem;
  font-size: clamp(2rem, 5vw, 3.45rem);
}

#role-rotator {
  display: inline-block;
  min-height: 1.2em;
  color: var(--accent);
  border-right: 2px solid color-mix(in srgb, var(--accent) 72%, transparent);
  white-space: nowrap;
}

.hero-copy {
  margin-top: 1rem;
  max-width: 62ch;
  color: var(--muted);
}

.hero-cta {
  margin-top: 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.btn {
  border-radius: 11px;
  border: 1px solid transparent;
  padding: 0.66rem 0.9rem;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: 180ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn.primary {
  background: linear-gradient(100deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 10px 22px color-mix(in srgb, var(--primary) 30%, transparent);
}

.btn.secondary {
  border-color: color-mix(in srgb, var(--primary) 34%, transparent);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.btn:hover {
  transform: translateY(-2px);
}

.hero-side {
  width: 340px;
  justify-self: end;
  min-height: 0;
  display: block;
}

.portrait-card {
  width: 340px;
  position: relative;
  background: linear-gradient(160deg, color-mix(in srgb, var(--surface) 92%, transparent), color-mix(in srgb, var(--primary) 4%, transparent));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 0.66rem;
  box-shadow: var(--shadow);
}

.portrait-card img {
  width: 100%;
  height: 430px;
  object-fit: cover;
  object-position: center 10%;
  border-radius: 14px;
  display: block;
}

.badge {
  position: absolute;
  right: 10px;
  bottom: 12px;
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.32rem 0.55rem;
}

.metrics {
  margin-top: 1.1rem;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: var(--shadow);
  padding: 0.85rem;
}

.metric h3 {
  color: var(--primary);
  font-size: 1.45rem;
  font-family: "Space Grotesk", sans-serif;
}

.metric p {
  margin: 0.24rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.panel {
  margin-top: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  box-shadow: var(--shadow);
  padding: 1rem;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.7rem;
  margin-bottom: 0.75rem;
}

.section-head h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.section-head p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.about-grid {
  display: block;
}

.about-copy p {
  margin: 0 0 0.72rem;
  color: var(--muted);
  text-align: justify;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.66rem;
}

.chip {
  border: 1px solid color-mix(in srgb, var(--primary) 26%, transparent);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.38rem 0.62rem;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.chip.active,
.chip:hover {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.skills-note {
  margin: 0.1rem 0 0.75rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.skills-toolbar {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

#skills-search {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  font-size: 0.88rem;
  font-family: inherit;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--text);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.skill-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: 0 10px 22px color-mix(in srgb, var(--text) 6%, transparent);
  padding: 0.62rem;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 0.58rem;
  align-items: center;
  transition: 170ms ease;
}

.skill-item:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--primary) 34%, transparent);
}

.skill-icon {
  width: 38px;
  height: 38px;
  border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  display: grid;
  place-items: center;
}

.skill-icon img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.skill-mark {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: color-mix(in srgb, var(--text) 84%, transparent);
}

.skill-name {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--text) 94%, transparent);
}

.skill-context {
  margin: 0.18rem 0 0;
  font-size: 0.74rem;
  color: var(--muted);
}

.skills-empty {
  display: none;
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.edu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.66rem;
}

.edu-grid article {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
}

.edu-grid h3 {
  font-size: 0.99rem;
  color: color-mix(in srgb, var(--text) 92%, transparent);
}

.edu-grid .meta {
  margin: 0.26rem 0;
  font-size: 0.79rem;
  color: var(--primary);
  font-weight: 700;
}

.edu-grid p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.timeline {
  display: grid;
  gap: 0.6rem;
}

.xp {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
}

.xp-head {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0.82rem;
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  cursor: pointer;
  color: inherit;
}

.xp-head h3 {
  font-size: 0.98rem;
}

.xp-head p {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 700;
}

.xp-head span {
  width: 28px;
  height: 28px;
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  border-radius: 999px;
  color: var(--primary);
  display: grid;
  place-items: center;
  font-weight: 800;
  flex-shrink: 0;
  transition: 180ms ease;
}

.xp.open .xp-head span {
  transform: rotate(45deg);
}

.xp-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 220ms ease;
}

.xp-body p {
  margin: 0;
  padding: 0 0.82rem 0.82rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.project-controls {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 0.66rem;
}

#project-search {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  font-size: 0.88rem;
  font-family: inherit;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--text);
}

#skills-search:focus,
#project-search:focus,
#palette-input:focus {
  outline: 2px solid color-mix(in srgb, var(--primary) 26%, transparent);
  outline-offset: 1px;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.66rem;
}

.project {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  display: grid;
  grid-template-rows: 190px auto;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.project:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.project.hide {
  display: none;
}

.project img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: color-mix(in srgb, var(--line) 30%, transparent);
}

.project video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: color-mix(in srgb, var(--line) 30%, transparent);
  display: block;
}

.project > div {
  padding: 0.72rem;
}

.project h3 {
  font-size: 0.98rem;
}

.project p {
  margin: 0.28rem 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.tags {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.tags span {
  border: 1px solid color-mix(in srgb, var(--primary) 24%, transparent);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.42rem;
  text-transform: uppercase;
}

.project-links {
  margin-top: 0.4rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.project-links a,
.project-links button {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: color-mix(in srgb, var(--text) 90%, transparent);
  border-radius: 8px;
  padding: 0.34rem 0.52rem;
  font-size: 0.76rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.project-links a:hover,
.project-links button:hover {
  border-color: color-mix(in srgb, var(--primary) 32%, transparent);
  color: var(--primary);
}

.empty {
  display: none;
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.contact-grid article {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.78rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

.contact-grid h3 {
  font-size: 0.9rem;
}

.contact-grid a,
.contact-grid p {
  margin: 0.26rem 0 0;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.83rem;
  word-break: break-word;
}

.contact-grid a:hover {
  color: var(--primary);
}

.footer {
  padding: 1.7rem 0 2rem;
}

.footer p {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.to-top {
  position: fixed;
  right: 0.9rem;
  bottom: 0.9rem;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--primary);
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: 180ms ease;
}

.to-top.show {
  opacity: 1;
  visibility: visible;
}

.modal,
.palette {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0.8rem;
  z-index: 30;
}

.modal.open,
.palette.open {
  display: flex;
}

.modal-card,
.palette-card {
  width: min(680px, 100%);
  max-height: 88vh;
  overflow: auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: var(--surface);
  color: var(--text);
  padding: 0.8rem;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: start;
  margin-bottom: 0.5rem;
}

.modal-head h3 {
  font-size: 1.05rem;
}

.modal-head button {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
}

#modal-body {
  color: var(--muted);
  font-size: 0.86rem;
}

#modal-body ul {
  margin: 0;
  padding-left: 1rem;
}

#palette-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.62rem;
  font-family: inherit;
  font-size: 0.86rem;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--text);
}

#palette-list {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.32rem;
}

#palette-list li button {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--text);
  font-family: inherit;
  font-size: 0.83rem;
  padding: 0.54rem;
  cursor: pointer;
}

#palette-list li button:hover,
#palette-list li button.active {
  border-color: color-mix(in srgb, var(--primary) 36%, transparent);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 500ms ease, transform 500ms ease;
}

.reveal.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .hero,
  .skills-grid,
  .metrics,
  .project-grid,
  .edu-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .hero-side {
    width: 100%;
    justify-self: stretch;
    margin-top: 0.5rem;
  }

  .portrait-card {
    width: min(100%, 340px);
    margin-inline: auto;
  }

  .nav-wrap {
    flex-wrap: wrap;
    justify-content: center;
    padding: 0.4rem 0;
  }

  .nav {
    justify-content: center;
  }

  .nav-actions {
    width: 100%;
    justify-content: center;
  }

  .portrait-card img {
    height: 360px;
  }

}

@media (max-width: 640px) {
  .container {
    width: min(1160px, calc(100% - 1.2rem));
  }

  .site-header {
    position: static;
  }

  .brand {
    display: none;
  }

  .nav {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav a {
    white-space: nowrap;
  }
}

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