:root {
  --bg: #0b0b0c;
  --surface: #141416;
  --border: #232327;
  --text: #e7e7ea;
  --muted: #8a8a93;
  --accent: #7c9cff;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

main {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 18vh 16px 48px;
  flex: 1;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.lede {
  color: var(--muted);
  margin-top: 4px;
}

.projects {
  list-style: none;
  margin-top: 40px;
  border-top: 1px solid var(--border);
}

.projects a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: color .15s, padding .15s;
}

.projects a:hover,
.projects a:focus-visible {
  color: var(--accent);
  padding-left: 6px;
  outline: none;
}

.projects .desc {
  color: var(--muted);
  font-size: .875rem;
  text-align: right;
}

a { color: var(--accent); }

footer {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px;
  color: var(--muted);
  font-size: .8125rem;
}

footer a { color: var(--muted); }
footer a:hover { color: var(--text); }

.projects .icon {
  display: inline-block;
  width: 1em;
  margin-left: 10px;
  text-align: center;
  color: var(--muted);
  transition: color .15s, transform .15s;
}

.projects a:hover .icon { color: var(--accent); transform: translateX(2px); }

.error { color: var(--muted); padding: 14px 0; list-style: none; }

/* modal */

body:has(dialog[open]) { overflow: hidden; }

dialog {
  width: min(720px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  margin: auto;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .6);
  overflow: hidden auto;
}

dialog[open] { animation: pop .18s ease-out; }

dialog::backdrop {
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(6px);
}

@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
}

.close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .5);
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.close:hover { background: rgba(0, 0, 0, .75); }

.modal-text { padding: 24px; }

.modal-text h2 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.modal-text p { color: var(--muted); }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin-top: 16px;
}

.tags li {
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .75rem;
  color: var(--muted);
}

.button {
  display: inline-block;
  margin-top: 20px;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
  transition: opacity .15s;
}

.button:hover { opacity: .85; }

/* carousel */

.carousel { position: relative; background: var(--bg); }

.track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

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

.slide {
  flex: 0 0 100%;
  aspect-ratio: 16 / 10;
  scroll-snap-align: start;
}

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

.nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .5);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, background .15s;
  backdrop-filter: blur(4px);
}

.nav.prev { left: 12px; }
.nav.next { right: 12px; }
.carousel:hover .nav, .nav:focus-visible { opacity: 1; }
.nav:hover { background: rgba(0, 0, 0, .75); }

@media (hover: none) { .nav { opacity: 1; } }

.dots {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.dots button {
  width: 6px;
  height: 6px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .4);
  cursor: pointer;
  transition: width .2s, background .2s;
}

.dots button.active { width: 18px; background: #fff; }

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