@font-face {
  font-family: "Montserrat";
  src: url("resources/font/Montserrat/Montserrat-VariableFont_wght.ttf") format("truetype");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Roboto Mono";
  src: url("resources/font/Roboto_Mono/RobotoMono-VariableFont_wght.ttf") format("truetype");
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans Thai Looped";
  src: url("resources/font/IBM_Plex_Sans_Thai_Looped/IBMPlexSansThaiLooped-Medium.ttf") format("truetype");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #fff;
  --header: rgba(255, 255, 255, .82);
  --surface: #fff;
  --ink: #202023;
  --muted: #4a5568;
  --line: rgba(32, 32, 35, .18);
  --heading-line: rgba(32, 32, 35, .24);
  --button: #fff;
  --toggle: #fbd38d;
  --shadow: 0 10px 30px rgba(32, 32, 35, .14);
  --shell-width: 736px;
  --content-width: 576px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #202023;
  --header: rgba(32, 32, 35, .86);
  --surface: #2d2d30;
  --ink: rgba(255, 255, 255, .92);
  --muted: rgba(255, 255, 255, .64);
  --line: rgba(255, 255, 255, .16);
  --heading-line: rgba(255, 255, 255, .28);
  --button: #fff;
  --toggle: #fbd38d;
  --shadow: 0 12px 34px rgba(0, 0, 0, .3);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  transition: background-color .2s ease, color .2s ease;
}

.glass-root {
  position: relative;
  min-height: 100vh;
  -webkit-user-select: text !important;
  user-select: text !important;
}

.page-background {
  position: fixed;
  z-index: 0;
  inset: 0;
  background: var(--bg);
  pointer-events: none;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  color: inherit;
  font: inherit;
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 16px;
  width: min(calc(100% - 16px), calc(var(--shell-width) + 32px));
  margin: 8px auto 0;
  border: 1px solid transparent;
  border-radius: 18px;
  background: transparent;
  transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.site-header.is-scrolled {
  border-color: var(--line);
  background: var(--header);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .16);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
}

.mobile-menu-glass {
  display: none;
  position: fixed;
  z-index: 19;
  border: 1px solid var(--line);
  border-radius: 8px;
  pointer-events: none;
}

.mobile-menu-glass.is-open {
  display: block;
}

.liquid-glass-ready .nav-links.is-open {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.nav-shell {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: min(calc(100% - 32px), var(--shell-width));
  height: 56px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 8px;
  font-family: "IBM Plex Sans Thai Looped", Arial, sans-serif;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -.02em;
}

.brand-logo {
  display: block;
  width: 24px;
  height: 32px;
  object-fit: contain;
  filter: none;
  transform: translateY(-1px);
}

[data-theme="dark"] .brand-logo {
  filter: invert(1);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
  font-family: "Montserrat", sans-serif;
}

.nav-links a {
  position: relative;
  padding: 4px 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
}

.nav-links a::after {
  position: absolute;
  right: 0;
  bottom: 3px;
  left: 0;
  height: 1px;
  background: var(--heading-line);
  content: "";
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .24s ease;
}

.nav-links a:hover::after,
.nav-links a:focus-visible::after {
  transform: scaleX(1);
}

.nav-actions {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 8px;
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  place-items: center;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: filter .15s ease, transform .15s ease;
}

.icon-button:hover {
  filter: brightness(.96);
  transform: translateY(-1px);
}

.theme-toggle {
  border-color: transparent;
  background: #2d3748;
  color: #fff;
}

.theme-icon {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.sun-icon {
  display: none;
}

.moon-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle {
  background: var(--toggle);
  color: #202023;
}

[data-theme="dark"] .sun-icon {
  display: block;
}

[data-theme="dark"] .moon-icon {
  display: none;
}

.menu-toggle {
  display: none;
}

.page-shell {
  width: min(calc(100% - 32px), var(--shell-width));
  margin: 0 auto;
}

.hero,
.content-section {
  width: min(100%, var(--content-width));
  margin: 0 auto;
}

.hero {
  padding: 54px 0 24px;
}

.cover-image-frame {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  margin-bottom: 28px;
  overflow: hidden;
  background: var(--bg);
}

.cover-image-placeholder,
.cover-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-image-placeholder {
  image-rendering: pixelated;
  opacity: 1;
  transition: opacity .24s ease;
}

.cover-image {
  opacity: 0;
  transition: opacity .24s ease;
}

.cover-image-frame.is-loaded .cover-image-placeholder {
  opacity: 0;
}

.cover-image-frame.is-loaded .cover-image {
  opacity: 1;
}

.identity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
}

.identity-copy {
  min-width: 0;
}

.profile-avatar {
  display: block;
  flex: 0 0 auto;
  width: 88px;
  height: 88px;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 50%;
  object-fit: cover;
}

@media (hover: hover) and (pointer: fine) {
  .profile-avatar {
    visibility: hidden;
    opacity: 0;
    clip-path: circle(0 at 50% 50%);
    -webkit-clip-path: circle(0 at 50% 50%);
    transition:
      visibility 0s linear .16s,
      opacity .16s ease,
      clip-path .16s ease,
      -webkit-clip-path .16s ease;
  }

  .identity-copy:hover + .profile-avatar {
    visibility: visible;
    opacity: 1;
    clip-path: circle(50% at 50% 50%);
    -webkit-clip-path: circle(50% at 50% 50%);
    transition:
      visibility 0s linear .24s,
      opacity .18s ease .24s,
      clip-path .18s ease .24s,
      -webkit-clip-path .18s ease .24s;
  }
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  position: relative;
  width: fit-content;
  margin-bottom: 0;
  font-family: "IBM Plex Sans Thai Looped", Arial, sans-serif;
  font-weight: 500;
  font-size: 30px;
  line-height: 1.33;
  letter-spacing: .04em;
}

h1::after {
  position: absolute;
  right: 0;
  bottom: -4px;
  left: 0;
  height: 1px;
  background: var(--heading-line);
  content: "";
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .24s ease;
}

h1:hover::after {
  transform: scaleX(1);
}

.content-section {
  padding: 30px 0;
}

.content-section h2 {
  position: relative;
  width: fit-content;
  margin: 0 0 16px;
  font-family: "Montserrat", sans-serif;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.33;
}

.content-section h2::after {
  position: absolute;
  right: 0;
  bottom: -3px;
  left: 0;
  height: 1px;
  background: var(--heading-line);
  content: "";
  transform: scaleX(1);
  transform-origin: left center;
  transition: transform .24s ease;
}

.section-copy {
  margin-bottom: 16px;
  color: var(--muted);
  font-family: "Roboto Mono", monospace;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: normal;
  line-height: 1.6;
  text-align: justify;
  text-indent: 1em;
}

.document-links {
  display: grid;
  justify-items: start;
  gap: 4px;
  font-family: "Roboto Mono", monospace;
}

.document-links a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 5px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 400;
}

.document-links a span,
.affiliate-links a span {
  position: relative;
}

.document-links a span::after,
.affiliate-links a span::after {
  position: absolute;
  right: 0;
  bottom: -3px;
  left: 0;
  height: 1px;
  background: var(--heading-line);
  content: "";
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .24s ease;
}

.document-links a:hover span::after,
.document-links a:focus-visible span::after,
.affiliate-links a:hover span::after,
.affiliate-links a:focus-visible span::after {
  transform: scaleX(1);
}

.document-icon {
  display: block;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  background: currentColor;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
}

.resume-icon,
.cv-icon {
  mask-image: url("resources/icons/filetype-pdf.svg");
  -webkit-mask-image: url("resources/icons/filetype-pdf.svg");
}

.bio-list {
  display: grid;
  gap: 12px;
  width: 100%;
}

.bio-item {
  display: grid;
  grid-template-columns: max-content 1fr;
  align-items: start;
  column-gap: 20px;
  width: 100%;
}

.bio-item time {
  padding-left: 16px;
  font-family: "Roboto Mono", monospace;
  font-size: 14px;
  font-weight: 400;
  white-space: nowrap;
}

.bio-item p {
  width: 100%;
  margin: 0;
  color: var(--muted);
  font-family: "Roboto Mono", monospace;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: normal;
  line-height: 1.6;
  text-align: justify;
}

.affiliate-links {
  display: grid;
  justify-items: start;
  gap: 4px;
  font-family: "Roboto Mono", monospace;
}

.affiliate-links a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 5px 16px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
}

.social-icon {
  display: block;
  width: 18px;
  height: 18px;
  background: currentColor;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
}

.github-icon {
  mask-image: url("resources/icons/github.svg");
  -webkit-mask-image: url("resources/icons/github.svg");
}

.linkedin-icon {
  mask-image: url("resources/icons/linkedin.svg");
  -webkit-mask-image: url("resources/icons/linkedin.svg");
}

.twitter-icon {
  mask-image: url("resources/icons/twitter.svg");
  -webkit-mask-image: url("resources/icons/twitter.svg");
}

.instagram-icon {
  mask-image: url("resources/icons/instagram.svg");
  -webkit-mask-image: url("resources/icons/instagram.svg");
}

footer {
  display: flex;
  justify-content: space-between;
  width: min(calc(100% - 32px), var(--content-width));
  margin: 32px auto 0;
  padding: 24px 0 40px;
  color: var(--muted);
  font-family: "Roboto Mono", monospace;
  font-size: 13px;
}

footer p {
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: .01ms !important;
  }
}

@media (max-width: 720px) {
  .nav-shell {
    grid-template-columns: 1fr auto;
    height: 56px;
  }

  .nav-links {
    position: absolute;
    top: calc(56px + 8px);
    right: 16px;
    display: none;
    gap: 2px;
    width: min(220px, calc(100vw - 32px));
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .nav-links.is-open {
    display: grid;
  }

  .nav-links a {
    justify-self: start;
    padding: 8px 10px;
    border-radius: 5px;
  }

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

  .nav-links a:hover {
    background: transparent;
    text-decoration: none;
  }

  .menu-toggle {
    display: grid;
    position: relative;
  }

  .menu-toggle span {
    position: absolute;
    top: 50%;
    left: 50%;
    display: block;
    width: 16px;
    height: 1.5px;
    background: currentColor;
    transform: translate(-50%, -50%);
    transform-origin: center;
    transition: top .2s ease, opacity .2s ease, transform .2s ease;
  }

  .menu-toggle span:first-child {
    top: calc(50% - 4px);
  }

  .menu-toggle span:last-child {
    top: calc(50% + 4px);
  }

  .menu-toggle[aria-expanded="true"] span:first-child {
    top: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
  }

  .menu-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }

  .menu-toggle[aria-expanded="true"] span:last-child {
    top: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
  }

  .hero {
    padding-top: 34px;
  }

  .identity {
    gap: 16px;
  }

  .cover-image-frame {
    margin-bottom: 24px;
  }

  .profile-avatar {
    width: 72px;
    height: 72px;
  }

  h1 {
    font-size: 24px;
  }

  .content-section {
    padding: 26px 0;
  }

  .section-copy {
    text-align: left;
  }

  .bio-item p {
    text-align: left;
  }
}

@media (max-width: 480px) {
  .brand {
    max-width: 170px;
    font-size: 15px;
  }

  footer {
    display: block;
  }

  footer p + p {
    margin-top: 4px;
  }
}
