:root {
  color-scheme: light;
  --bg: #e9eff5;
  --surface: #f6f9fb;
  --surface-raised: #fbfcfd;
  --surface-soft: #e1eaf2;
  --text: #17202f;
  --muted: #64748b;
  --line: #cfd9e3;
  --teal: #07858d;
  --teal-dark: #06616a;
  --amber: #f59f00;
  --shadow: 0 18px 60px rgba(15, 23, 42, 0.08);
  --radius: 8px;
  --max: 1500px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d131a;
  --surface: #141c24;
  --surface-raised: #19232e;
  --surface-soft: #101820;
  --text: #eef5f8;
  --muted: #9cabba;
  --line: #2c3a47;
  --teal: #31c3c9;
  --teal-dark: #77dbe0;
  --amber: #ffc95c;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  transition: background-color 180ms ease, color 180ms ease;
}

p,
li,
h1,
h2,
h3 {
  overflow-wrap: anywhere;
}

button,
a {
  font: inherit;
}

a {
  color: inherit;
}

svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.site-shell {
  width: min(var(--max), calc(100% - 24px));
  margin: 12px auto 28px;
}

.topbar {
  position: sticky;
  top: 8px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-raised) 92%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
  text-decoration: none;
}

.brand-mark {
  color: var(--teal);
  font-size: clamp(1.5rem, 3vw, 2.3rem);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
}

.brand-name,
.brand-role {
  display: block;
}

.brand-name {
  font-size: 1.05rem;
}

.brand-role {
  color: var(--muted);
  font-size: 0.84rem;
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  width: 100%;
}

.nav-button,
.filter-button,
.modal-close {
  border: 0;
  cursor: pointer;
}

.nav-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  white-space: nowrap;
}

.nav-button::after {
  position: absolute;
  right: 12px;
  bottom: 2px;
  left: 12px;
  height: 2px;
  border-radius: 999px;
  background: transparent;
  content: "";
}

.nav-button:hover,
.nav-button:focus-visible,
.nav-button.is-active {
  color: var(--teal-dark);
  background: color-mix(in srgb, var(--teal) 12%, transparent);
}

.nav-button.is-active::after {
  background: var(--teal);
}

.nav-label {
  font-size: 0.86rem;
  font-weight: 650;
}

.content {
  padding: 26px 0 0;
}

.theme-toggle {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--teal-dark);
  border-color: color-mix(in srgb, var(--teal) 55%, var(--line));
}

.theme-icon {
  position: absolute;
  transition: opacity 160ms ease, transform 160ms ease;
}

.theme-icon-moon {
  opacity: 0;
  transform: rotate(-30deg) scale(0.7);
}

html[data-theme="dark"] .theme-icon-sun {
  opacity: 0;
  transform: rotate(30deg) scale(0.7);
}

html[data-theme="dark"] .theme-icon-moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.page {
  display: none;
  min-width: 0;
  scroll-margin-top: 130px;
}

.page.is-active {
  display: block;
}

.page-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: var(--teal);
}

.page-title h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.85rem, 4vw, 2.6rem);
  line-height: 1.05;
}

.split-title {
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.split-title > span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.about-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 1fr);
  gap: 14px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.04);
}

.panel h2 {
  margin: 0 0 14px;
  color: var(--teal-dark);
  font-size: 1rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.panel h3 {
  margin: 14px 0 8px;
  color: var(--text);
  font-size: 0.9rem;
}

.intro-panel {
  grid-column: 1 / -1;
}

.intro-grid {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  gap: 22px;
  align-items: center;
}

.portrait,
.thumb {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #0f172a, #07858d 55%, #f59f00);
}

.portrait {
  display: grid;
  width: 100%;
  aspect-ratio: 4 / 3;
  place-items: center;
  color: white;
}

.portrait span {
  font-size: 3.2rem;
  font-weight: 850;
}

.contact-chips,
.tags,
.modal-links,
.contact-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.contact-chips span,
.tags span,
.contact-list a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text);
  font-size: 0.86rem;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.modal-links a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--teal) 50%, var(--line));
  border-radius: var(--radius);
  background: var(--teal);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.modal-links a:hover,
.modal-links a:focus-visible {
  background: var(--teal-dark);
}

.language-list,
.feature-list,
.timeline {
  display: grid;
  gap: 12px;
}

.language-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.language-row strong {
  color: var(--muted);
  font-size: 0.84rem;
}

.language-row i {
  grid-column: 1 / -1;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal) var(--level), #d9dee5 var(--level));
}

.feature-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.feature-list li {
  display: grid;
  gap: 2px;
}

.feature-list span,
.meta,
.panel p {
  color: var(--muted);
}

.interests-panel {
  grid-column: 1 / -1;
}

.interest-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
}

.interest-grid span {
  display: grid;
  min-height: 72px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text);
  font-weight: 650;
  text-align: center;
}

.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.two-column > :only-child {
  grid-column: 1 / -1;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 340px));
  gap: 14px;
  justify-content: start;
}

.education-card p,
.work-card p {
  max-width: 72ch;
}

.work-card {
  position: relative;
  padding-left: 24px;
}

.work-card::before {
  position: absolute;
  top: 22px;
  bottom: 22px;
  left: 11px;
  width: 3px;
  border-radius: 999px;
  background: var(--teal);
  content: "";
}

.date-range {
  display: inline-flex;
  margin-bottom: 10px;
  color: var(--amber);
  font-size: 0.84rem;
  font-weight: 800;
}

.filter-bar {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.filter-button {
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.filter-button:hover,
.filter-button:focus-visible,
.filter-button.is-active {
  background: var(--teal);
  color: #ffffff;
}

.project-card,
.certificate-card {
  display: grid;
  gap: 12px;
  padding: 0;
  overflow: hidden;
  text-align: left;
}

.item-button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.04);
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.item-button:hover,
.item-button:focus-visible {
  border-color: rgba(7, 133, 141, 0.45);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.1);
  transform: translateY(-2px);
}

.thumb {
  display: grid;
  aspect-ratio: 16 / 9;
  place-items: center;
  color: #fff;
  font-size: 2rem;
  font-weight: 850;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb.unity {
  background: linear-gradient(135deg, #17202f, #07858d);
}

.thumb.unreal {
  background: linear-gradient(135deg, #111827, #4c5fd5);
}

.thumb.ai {
  background: linear-gradient(135deg, #07858d, #f59f00);
}

.thumb.cert {
  background: linear-gradient(135deg, #ffffff, #eefafa);
  color: var(--teal);
}

.thumb.cert img {
  object-fit: contain;
  padding: 10px;
  background: var(--surface-raised);
}

.item-content {
  padding: 14px;
}

.item-content h2 {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 1rem;
}

.item-content p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.contact-panel {
  max-width: 760px;
}

.modal {
  width: min(960px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  color: var(--text);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(6px);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-raised) 92%, transparent);
  color: var(--text);
  z-index: 2;
}

.modal-media {
  min-height: 260px;
  background: linear-gradient(135deg, #0f172a, #07858d, #f59f00);
}

.modal-media img {
  max-height: 440px;
  object-fit: contain;
  background: var(--surface-soft);
}

.info-media {
  display: block;
  min-height: 0;
  max-height: min(50vh, 480px);
  overflow: auto;
  padding: 22px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.detail-list div {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.detail-list div:last-child {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.detail-list div:nth-child(3),
.detail-list div:nth-child(n + 4) {
  grid-column: 1 / -1;
}

.detail-list dt {
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.detail-list dd {
  margin: 0;
  color: var(--text);
  font-size: 0.94rem;
  line-height: 1.55;
}

.modal-body {
  background: var(--surface);
  padding: 24px 56px 20px 24px;
}

.modal-kicker {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 0.84rem;
  font-weight: 850;
  text-transform: uppercase;
}

.modal-body h2 {
  margin: 0 0 8px;
  font-size: clamp(1.45rem, 4vw, 2rem);
}

.modal-body > p {
  max-width: 78ch;
}

.modal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.modal-tags {
  margin-top: 14px;
}

.modal-tags span {
  min-height: 28px;
  padding: 4px 8px;
  border-style: dashed;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

@media (max-width: 1180px) {
  .topbar {
    position: sticky;
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .theme-toggle {
    position: absolute;
    top: 12px;
    right: 16px;
  }

  .brand {
    padding-right: 54px;
    min-width: auto;
  }

  .brand-role {
    display: none;
  }

  .nav-label {
    display: none;
  }

  .nav-button {
    width: 100%;
    padding: 8px;
  }

  .main-nav {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    justify-content: stretch;
    width: min(100%, 360px);
  }

  .nav-button::after {
    right: 10px;
    left: 10px;
  }
}

@media (max-width: 900px) {
  .site-shell {
    width: calc(100% - 16px);
    margin-top: 8px;
  }

  .topbar {
  }

  .main-nav {
  }

  .nav-button {
    min-width: 0;
  }

  .about-layout,
  .two-column,
  .card-grid {
    grid-template-columns: 1fr;
  }

  .intro-panel {
    grid-column: auto;
  }

  .intro-grid {
    grid-template-columns: 1fr;
  }

  .portrait {
    max-height: 280px;
  }

  .interest-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-title {
    display: grid;
  }

  .filter-bar {
    width: 100%;
    overflow-x: auto;
  }

  .detail-list {
    grid-template-columns: 1fr;
  }

  .detail-list div:nth-child(3),
  .detail-list div:nth-child(n + 4) {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .site-shell {
    width: 100%;
    max-width: 390px;
    margin-right: auto;
    margin-left: 0;
    margin-top: 0;
  }

  .topbar {
    top: 0;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    padding: 10px 8px;
  }

  .theme-toggle {
    top: 10px;
    right: 8px;
    width: 40px;
    height: 40px;
  }

  .brand-name {
    font-size: 0.98rem;
  }

  .main-nav {
    gap: 0;
  }

  .nav-button {
    width: 100%;
    min-height: 40px;
    padding: 6px;
  }

  .content {
    padding-inline: 8px;
  }

  .panel,
  .modal-body {
    padding: 14px;
  }

  .contact-chips span,
  .tags span,
  .modal-links a,
  .contact-list a {
    width: 100%;
  }

  .interest-grid {
    grid-template-columns: 1fr;
  }

  .modal-media {
    min-height: 190px;
  }
}

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