:root,
html[data-theme="dark"] {
  --bg: #090908;
  --ink: #ffffff;
  --muted: #9ca3af;
  --line: rgba(255, 255, 255, 0.08);
  --card: #111110;
  --card-hover: #161614;
  --accent: #14b8a6;
  --accent-soft: rgba(20, 184, 166, 0.12);
  --watch: #ef4444;
  --github: #d1d5db;
  --demo: #3b82f6;
  --button-bg: #1f1f1c;
  --bio: #e5e7eb;
  --img-bg: #0c0c0b;
  --selection: #1f2937;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #ffffff;
  --ink: #111110;
  --muted: #6b7280;
  --line: rgba(17, 17, 16, 0.1);
  --card: #f7f7f5;
  --card-hover: #efefed;
  --accent: #0f9d8e;
  --accent-soft: rgba(20, 184, 166, 0.12);
  --watch: #dc2626;
  --github: #374151;
  --demo: #2563eb;
  --button-bg: #f3f4f6;
  --bio: #1f2937;
  --img-bg: #e5e7eb;
  --selection: #e5e7eb;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, system-ui, sans-serif;
  font-weight: 400;
  line-height: 1.7;
}

::selection {
  background: var(--selection);
}

a {
  color: inherit;
}

.page {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 72px;
}

header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 -8px 56px;
  padding: 12px 8px;
  background: var(--bg);
}

.mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--accent);
  font-weight: 700;
  letter-spacing: -0.04em;
  text-decoration: none;
}

.mark:hover {
  border-color: rgba(20, 184, 166, 0.4);
}

.site-nav {
  display: flex;
  align-items: stretch;
  gap: 32px;
  height: 40px;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 4px 2px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
}

.site-nav a:hover {
  color: var(--ink);
}

.site-nav a.is-active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.theme-toggle {
  appearance: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  align-self: center;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: rgba(20, 184, 166, 0.3);
  color: var(--accent);
}

.theme-toggle svg {
  width: 24px;
  height: 24px;
  display: block;
}

.theme-toggle .icon-moon {
  display: none;
}

html[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

html[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

.theme-toggle:focus-visible,
.site-nav a:focus-visible,
.profile-socials a:focus-visible,
.mark:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 8px;
  margin-bottom: 48px;
  scroll-margin-top: 72px;
}

.profile img {
  width: 256px;
  height: 256px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  background: var(--img-bg);
}

.profile-name {
  margin: 16px 0 8px;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 2rem;
  letter-spacing: -0.025em;
}

.profile-title {
  margin: 0;
  color: var(--muted);
  text-align: center;
}

.profile-socials {
  display: flex;
  gap: 20px;
  padding-top: 24px;
}

.profile-socials a {
  color: var(--accent);
}

.profile-socials a:hover {
  color: #0d9488;
}

.profile-socials svg {
  width: 32px;
  height: 32px;
  display: block;
}

h1 {
  margin: 0 0 14px;
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.05em;
  text-align: center;
}

h1 span {
  color: var(--accent);
}

.lede {
  max-width: 34rem;
  margin: 0 auto 22px;
  color: var(--muted);
  font-size: 1.12rem;
  text-align: center;
}

.bio {
  max-width: 40rem;
  margin: 0 auto 36px;
  font-size: 1.05rem;
  color: var(--bio);
  text-align: center;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 36px;
  scroll-margin-top: 72px;
}

.pills button {
  appearance: none;
  cursor: pointer;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.pills button:hover {
  color: var(--ink);
  border-color: rgba(20, 184, 166, 0.4);
}

.pills button[aria-selected="true"] {
  color: var(--accent);
  border-color: rgba(20, 184, 166, 0.55);
  background: var(--accent-soft);
}

.pills button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.panel {
  display: none;
}

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

.intro {
  max-width: 44rem;
  margin: 0 0 28px;
}

.intro h2 {
  margin: 0 0 10px;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.intro p {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.project-search {
  position: relative;
  margin-top: 18px;
}

.project-search svg {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.project-search input {
  width: 100%;
  height: 46px;
  padding: 0 16px 0 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  outline: none;
  transition:
    border-color 0.18s ease,
    background 0.18s ease;
}

.project-search input::placeholder {
  color: var(--muted);
}

.project-search input:hover {
  border-color: rgba(20, 184, 166, 0.35);
}

.project-search input:focus {
  border-color: var(--accent);
  background: var(--card-hover);
}

.project-search input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.project-empty {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.projects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.project {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  align-self: start;
  transition: border-color 0.2s ease;
}

.project.is-open {
  border-color: rgba(20, 184, 166, 0.45);
}

.project > h3 {
  margin: 0;
}

.project-toggle {
  appearance: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  margin: 0;
  padding: 16px 18px;
  border: 0;
  background: #111110;
  color: #ffffff;
  text-align: left;
  font: inherit;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.3;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.project-toggle::after {
  content: "";
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  margin-top: -3px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.22s ease;
}

.project-toggle:hover,
.project-toggle:focus-visible,
.project.is-open .project-toggle {
  background: var(--accent);
  color: #042f2e;
}

.project.is-open .project-toggle::after {
  margin-top: 3px;
  transform: rotate(225deg);
}

.project-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.project-panel {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  pointer-events: none;
  transition:
    grid-template-rows 0.32s ease,
    visibility 0.32s ease;
}

.project.is-open .project-panel {
  grid-template-rows: 1fr;
  visibility: visible;
  pointer-events: auto;
}

.project-panel-inner {
  overflow: hidden;
  min-height: 0;
}

.project img {
  display: block;
  width: calc(50% - 10px);
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: top;
  margin: 10px auto 0;
  border-radius: 16px;
  background: var(--img-bg);
}

.project-body {
  padding: 18px 22px 20px;
}

.project p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.98rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 18px;
  align-items: center;
}

.actions a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

.actions a.watch {
  color: var(--watch);
}

.actions a.github {
  color: var(--github);
}

.actions a.demo {
  color: var(--demo);
}

.actions svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.lab .project-body {
  padding: 18px 22px 20px;
}

.lab p {
  margin-bottom: 14px;
}

.more {
  margin-top: 22px;
}

.more a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.more a:hover {
  text-decoration: underline;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.pagination[hidden] {
  display: none;
}

.pagination-size {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.pagination-sizes,
.pagination-pages,
.pagination-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.pagination button {
  appearance: none;
  cursor: pointer;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.pagination-prev,
.pagination-next {
  min-width: auto;
  padding: 0 14px;
}

.pagination button:hover:not(:disabled) {
  color: var(--ink);
  border-color: rgba(20, 184, 166, 0.4);
}

.pagination button[aria-pressed="true"],
.pagination button[aria-current="page"] {
  color: var(--accent);
  border-color: rgba(20, 184, 166, 0.55);
  background: var(--accent-soft);
}

.pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.pagination button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 48px;
}

a.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink);
  background: var(--button-bg);
  border: 1px solid var(--line);
  font-weight: 500;
}

a.button.primary {
  color: #042f2e;
  background: var(--accent);
  border-color: transparent;
}

a.button:hover {
  transform: translateY(-1px);
}

footer {
  margin-top: 56px;
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 720px) {
  .page {
    width: min(1120px, calc(100% - 28px));
    padding-top: 20px;
  }

  header {
    margin-bottom: 36px;
  }

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

  .pagination {
    flex-direction: column;
    align-items: stretch;
  }

  .pagination-nav {
    justify-content: space-between;
  }

  .site-nav {
    gap: 16px;
  }

  .profile img {
    width: 192px;
    height: 192px;
  }
}
