:root {
  --bg: #f4f1ea;
  --ink: #1c1b17;
  --muted: #6b675c;
  --rule: #d9d3c5;
  --accent: #d2441f;
  --chip: #e9e4d8;
  --max: 68rem;
  font-family: ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16150f;
    --ink: #ece8dd;
    --muted: #9c978a;
    --rule: #35332b;
    --accent: #ff6a3d;
    --chip: #24231c;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 0.2em; }
a:hover { color: var(--accent); }

.masthead, main, .foot {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 40rem) {
  .masthead, main, .foot { padding: 0 2rem; }
}

/* Masthead */
.masthead { padding-top: 4rem; padding-bottom: 2.5rem; }

.mark {
  margin: 0 0 1.25rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 1.25rem;
  color: var(--accent);
  letter-spacing: 0.05em;
}

h1 {
  margin: 0;
  font-size: clamp(3rem, 11vw, 7.5rem);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.045em;
}

.lede {
  max-width: 34rem;
  margin: 1.5rem 0 0;
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  color: var(--muted);
}
.lede a { color: var(--ink); }

/* Filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1.25rem 0;
  border-top: 2px solid var(--ink);
}

.filters button {
  font: inherit;
  font-size: 0.875rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.filters button:hover { border-color: var(--ink); }
.filters button[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.filters button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Projects */
.projects {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  border-top: 1px solid var(--rule);
}

@media (min-width: 46rem) {
  .projects { grid-template-columns: 1fr 1fr; column-gap: 3rem; }
}

@media (min-width: 70rem) {
  .projects { grid-template-columns: 1fr 1fr 1fr; }
}

.projects > li { border-bottom: 1px solid var(--rule); }

.project { position: relative; padding: 1.75rem 0 2rem; }

.kind {
  margin: 0 0 0.5rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.project h2 {
  margin: 0 0 0.6rem;
  font-size: 1.6rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.project h2 a { text-decoration: none; }
/* The title link covers the whole card. */
.project h2 a::before { content: ""; position: absolute; inset: 0; }
.project h2 a::after { content: " →"; font-size: 0.8em; color: var(--muted); transition: margin 0.15s; }
.project:hover h2 a { color: var(--accent); }
.project:hover h2 a::after { margin-left: 0.2em; color: var(--accent); }
.project h2 a:focus-visible { outline: none; }
.project:has(h2 a:focus-visible) { outline: 2px solid var(--accent); outline-offset: 4px; }

.project p { margin: 0; }

.project .meta {
  margin-top: 1rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.empty { padding: 2rem 0; color: var(--muted); }

/* Footer */
.foot {
  padding-top: 3rem;
  padding-bottom: 3rem;
  font-size: 0.875rem;
  color: var(--muted);
}

/* Top bar (all pages) */
.topbar {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.25rem 1rem 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9375rem;
}
@media (min-width: 40rem) { .topbar { padding: 1.5rem 2rem 0; } }
.topbar a { text-decoration: none; }
.topbar .home { font-weight: 750; letter-spacing: -0.01em; }
.topbar .home span { font-family: ui-monospace, "SF Mono", Menlo, monospace; color: var(--accent); margin-right: 0.4em; }
.topbar nav { display: flex; gap: 1.25rem; }
.topbar nav a[aria-current="page"] { color: var(--accent); }
.masthead { padding-top: 3rem; }

/* Project and music pages */
.detail {
  max-width: 46rem;
  padding-top: 3.5rem;
}
.detail h1 { font-size: clamp(2.75rem, 9vw, 5rem); }
.detail .lede { color: var(--ink); max-width: none; }

.links {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.links a {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}
.links a:hover { background: var(--accent); color: #fff; }

.media { margin: 2.5rem 0 0; }
.media video, .media iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 10px;
  background: var(--chip);
}
.gallery {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scroll-snap-type: x mandatory;
}
.gallery img {
  flex: 0 0 auto;
  height: min(70vh, 34rem);
  width: auto;
  max-width: 85%;
  object-fit: contain;
  border-radius: 14px;
  border: 1px solid var(--rule);
  scroll-snap-align: start;
}
.media figcaption { margin-top: 0.6rem; font-size: 0.8125rem; color: var(--muted); }
.placeholder {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  border: 1.5px dashed var(--rule);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.9375rem;
  text-align: center;
  padding: 1rem;
}

.detail section { margin-top: 2.75rem; }
.detail section h2 {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.detail section p, .detail section li { font-size: 1.0625rem; }
.detail section p { margin: 0 0 1rem; }
.detail section ul { margin: 0 0 1rem; padding-left: 1.2rem; }
.detail section li { margin-bottom: 0.4rem; }
.detail code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.9em;
  background: var(--chip);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.facts {
  margin: 3rem 0 0;
  padding-top: 1.25rem;
  border-top: 2px solid var(--ink);
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.6rem 1.5rem;
  font-size: 0.9375rem;
}
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.back { display: inline-block; margin-top: 3rem; font-size: 0.9375rem; text-decoration: none; }

/* Music */
.tracks { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.tracks li { padding: 1rem 0; border-bottom: 1px solid var(--rule); }
.tracks iframe { width: 100%; border: 0; border-radius: 10px; }
