:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --rule: #e6e6e6;
  --link: #1a1a1a;
  --accent: #9CD29E;
  --maxw: 640px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111111;
    --fg: #ececec;
    --muted: #9a9a9a;
    --rule: #2a2a2a;
    --link: #ececec;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 0 1.25rem;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 4rem 0 5rem;
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  margin-bottom: 3.5rem;
}

.name {
  font-weight: 600;
  text-decoration: none;
  color: var(--fg);
  letter-spacing: -0.01em;
}

nav { display: flex; flex-wrap: wrap; gap: 1.25rem; }

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

nav a:hover, nav a[aria-current="page"] { color: var(--fg); }
nav a:hover { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; }

h1 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 1.5rem;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 3rem 0 1rem;
}

section:first-of-type h2 { margin-top: 0; }

p { margin: 0 0 1.25rem; }

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s;
}

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

ul { list-style: none; padding: 0; margin: 0; }

.items li {
  padding: 1.25rem 0;
  border-top: 1px solid var(--rule);
}

.items li:last-child { border-bottom: 1px solid var(--rule); }

.items .title { font-weight: 600; margin: 0 0 0.15rem; }

.items .meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 0.5rem;
}

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

.refs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.refs a { color: var(--muted); }

.refs a:hover { color: var(--fg); text-decoration-color: var(--accent); }

footer {
  margin-top: 5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}

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

footer a:hover { color: var(--fg); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; }

.muted { color: var(--muted); }

@media (max-width: 480px) {
  body { font-size: 16px; }
  .wrap { padding: 2.5rem 0 4rem; }
  header { margin-bottom: 2.5rem; }
}

/* Home portrait */
.intro {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 2.5rem;
  align-items: start;
}

.intro-text { order: 1; }
.portrait { order: 2; margin: 0.25rem 0 0; }

.portrait img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 0.9;
  object-fit: cover;
  object-position: center 30%;
  filter: grayscale(1) contrast(1.06);
  border-radius: 90px 0 90px 0;
}

@media (max-width: 600px) {
  .portrait img { border-radius: 64px 0 64px 0; }
}

@media (max-width: 600px) {
  .intro { grid-template-columns: 1fr; gap: 1.5rem; }
  .portrait { order: 1; width: 55%; max-width: 240px; }
  .intro-text { order: 2; }
}

/* Inline photo */
.photo { margin: 2.5rem 0 3rem; }

.photo img {
  display: block;
  width: 100%;
  height: auto;
  filter: grayscale(1) contrast(1.06);
  border-radius: 48px 0 48px 0;
}

.photo figcaption {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
}

@media (max-width: 600px) {
  .photo img { border-radius: 32px 0 32px 0; }
}

/* Project filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.filters button {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.filters button:hover { color: var(--fg); border-color: var(--accent); }

.filters button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1a1a;
}

.projects .project {
  padding: 1.5rem 0;
  border-top: 1px solid var(--rule);
}

.projects .project:last-child { border-bottom: 1px solid var(--rule); }

.project .title { font-weight: 600; margin: 0 0 0.15rem; }

.project .meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 0.6rem;
}

.project > p:not(.title):not(.meta) { margin-bottom: 0.75rem; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.6rem;
}

.tags li {
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.1rem 0.45rem;
  cursor: pointer;
}

.tags li:hover { color: var(--fg); border-color: var(--accent); }

.project .refs { margin-top: 0; }

.empty { padding: 1.5rem 0; }

/* News */
.news { margin-top: 3.5rem; }

.news ul { display: grid; gap: 1rem; }

.news li {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 1rem;
  align-items: baseline;
}

.news time {
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.news p { margin: 0; }

@media (max-width: 480px) {
  .news li { grid-template-columns: 1fr; gap: 0.15rem; }
}

.earlier { margin-top: 1.25rem; }

.earlier summary {
  display: inline-block;
  cursor: pointer;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  list-style: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1px;
}

.earlier summary::-webkit-details-marker { display: none; }

.earlier summary::after { content: " +"; }
.earlier[open] summary::after { content: " –"; }

.earlier summary:hover { color: var(--fg); border-color: var(--accent); }

.earlier ul { margin-top: 1rem; }
