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

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --text: #111111;
  --text-muted: #666666;
  --border: #e5e5e5;
  --link: #0066cc;
  --link-hover: #004499;
  --surface: #f7f7f7;
  --avatar-bg: #111111;
  --avatar-text: #ffffff;
  --max-width: 640px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0d0d;
    --text: #f2f2f2;
    --text-muted: #999999;
    --border: #2a2a2a;
    --link: #6eb6ff;
    --link-hover: #9eceff;
    --surface: #171717;
    --avatar-bg: #f2f2f2;
    --avatar-text: #111111;
  }
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --text: #111111;
  --text-muted: #666666;
  --border: #e5e5e5;
  --link: #0066cc;
  --link-hover: #004499;
  --surface: #f7f7f7;
  --avatar-bg: #111111;
  --avatar-text: #ffffff;
}

:root[data-theme="dark"] {
  --bg: #0d0d0d;
  --text: #f2f2f2;
  --text-muted: #999999;
  --border: #2a2a2a;
  --link: #6eb6ff;
  --link-hover: #9eceff;
  --surface: #171717;
  --avatar-bg: #f2f2f2;
  --avatar-text: #111111;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

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

.nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.875rem 1.25rem;
}

.nav__link {
  font-size: 0.9375rem;
  color: var(--text-muted);
  text-decoration: none;
}

.nav__link:hover {
  color: var(--text);
  text-decoration: none;
}

.nav__link--cta {
  color: var(--link);
}

.nav__link--cta:hover {
  color: var(--link-hover);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  margin-left: 0.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease;
}

.theme-toggle:hover {
  background: var(--border);
}

.theme-toggle__icon--sun {
  display: none;
}

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

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

:root[data-theme="light"] .theme-toggle__icon--moon {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle__icon--sun {
    display: block;
  }

  :root:not([data-theme]) .theme-toggle__icon--moon {
    display: none;
  }
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .theme-toggle__icon--moon {
    display: block;
  }

  :root:not([data-theme]) .theme-toggle__icon--sun {
    display: none;
  }
}

.main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

.hero {
  text-align: center;
  padding: 1rem 0 3rem;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 7rem;
  height: 7rem;
  margin-bottom: 1.25rem;
  border-radius: 50%;
  background: var(--avatar-bg);
  color: var(--avatar-text);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  overflow: hidden;
}

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

.avatar--photo {
  background: var(--border);
}

.hero__title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.hero__tagline {
  margin: 0 0 0.75rem;
  font-size: 1.125rem;
  color: var(--text-muted);
}

.hero__skills {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.section {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}

.section__title {
  margin: 0 0 1.25rem;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.section__note {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.project-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.project-filter {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  padding: 0.35rem 0.8rem;
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.project-filter.is-active {
  border-color: var(--link);
  color: var(--link);
}

.project-group + .project-group {
  margin-top: 1.75rem;
}

.project-group__title {
  margin: 0 0 0.75rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

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

.project-item + .project-item {
  margin-top: 1.25rem;
}

.project-item__link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.project-item__button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.project-item__button:hover .project-item__title {
  color: var(--link);
}

.project-item__layout {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
}

.project-item__content {
  flex: 1;
  min-width: 0;
}

.project-item__preview {
  position: relative;
  flex: 0 0 4.5rem;
  width: 4.5rem;
  height: 4.5rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.project-item__preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-item__preview--video {
  display: grid;
  place-items: center;
  color: var(--text-muted);
}

.project-item__preview-play {
  font-size: 1.125rem;
  line-height: 1;
}

.project-item__preview-count {
  position: absolute;
  right: 0.25rem;
  bottom: 0.25rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.project-item__hint {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.project-item__link:hover {
  text-decoration: none;
}

.project-item__link:hover .project-item__title {
  color: var(--link);
}

.project-item__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.15rem;
}

.project-item__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  transition: color 0.15s ease;
}

.project-item__badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.project-item__body {
  display: block;
}

.project-item__desc {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.about-text {
  margin: 0;
  width: 100%;
  color: var(--text-muted);
  text-align: left;
  line-height: 1.7;
}

.about-text p {
  margin: 0 0 1rem;
}

.about-text p:last-child {
  margin-bottom: 0;
}

.about-text ul,
.about-text ol {
  margin: 0 0 1rem;
  padding-left: 1.35rem;
}

.about-text li + li {
  margin-top: 0.35rem;
}

.about-text a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.about-text strong,
.about-text b {
  display: block;
  margin: 1.25rem 0 0.5rem;
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.about-text p:first-child strong,
.about-text p:first-child b,
.about-text > strong:first-child,
.about-text > b:first-child {
  margin-top: 0;
}

.contact-timezone {
  margin: -0.35rem 0 0.85rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
}

.contact-list a {
  font-size: 0.9375rem;
}

.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.site-footer p {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.site-footer p {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

body.modal-open,
body.viewer-open {
  overflow: hidden;
}

.project-modal,
.media-viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.project-modal[hidden],
.media-viewer[hidden] {
  display: none;
}

.project-modal__backdrop,
.media-viewer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.project-modal__dialog {
  position: relative;
  max-width: 720px;
  max-height: calc(100vh - 2rem);
  margin: 1rem auto;
  overflow: auto;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.project-modal__close,
.media-viewer__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.project-modal__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-right: 2.5rem;
  margin-bottom: 0.75rem;
}

.project-modal__title {
  margin: 0;
  font-size: 1.25rem;
}

.project-modal__summary {
  margin: 0 0 1rem;
  color: var(--text-muted);
}

.project-modal__details {
  margin-bottom: 1rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.project-modal__details p {
  margin: 0 0 0.75rem;
}

.project-modal__media {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.project-media-card {
  display: grid;
  place-items: center;
  min-height: 110px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
}

.project-media-card img {
  width: 100%;
  height: 110px;
  object-fit: cover;
}

.project-media-card--video {
  color: var(--text);
}

.project-media-card__play {
  font-size: 1.75rem;
}

.project-media-card__caption {
  padding: 0 0.5rem 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.project-modal__details ul,
.project-modal__details ol {
  margin: 0 0 0.75rem;
  padding-left: 1.35rem;
}

.project-modal__summary[hidden],
.project-modal__details[hidden],
.project-modal__media[hidden],
.project-modal__link[hidden] {
  display: none;
}

.project-modal__link {
  display: inline-block;
  color: var(--link);
}

.media-viewer__content {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 100%;
  padding: 3rem 1rem 1rem;
}

.media-viewer__content img,
.media-viewer__content video {
  max-width: min(100%, 960px);
  max-height: calc(100vh - 4rem);
  border-radius: 10px;
  background: #000;
}

@media (max-width: 480px) {
  .nav {
    gap: 0.875rem;
  }

  .hero {
    padding-bottom: 2rem;
  }
}
