/* Project write-ups. Shared styles live in site.css. */

.page {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Title and cover */

.project-head { padding: clamp(2rem, 6vw, 4rem) 0 clamp(1.5rem, 3vw, 2rem); }

.project-head h1 { font-size: clamp(2.5rem, 7vw, 5.5rem); }

.project-head .lede { margin-top: 1rem; }

.project-cover {
  margin: 0 0 clamp(3rem, 6vw, 4.5rem);
  aspect-ratio: 16 / 8;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--cover-bg, var(--rule));
}

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

/* Article body */

.article { padding-bottom: clamp(2rem, 5vw, 3rem); }

.article > p,
.article > ul { max-width: 40em; }

.article p { margin: 0 0 1.1rem; }

.article h2 {
  margin: clamp(3rem, 6vw, 4rem) 0 1.25rem;
  font-size: clamp(1.6rem, 3vw, 2.25rem);
}

.article h2:first-child { margin-top: 0; }

.article hr {
  margin: clamp(3rem, 6vw, 4rem) 0 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

.article hr + h2 { margin-top: clamp(2rem, 4vw, 2.5rem); }

.article ul { margin: 0 0 1.1rem; padding-left: 1.25rem; }
.article li { padding: 0.15rem 0; }
.article li::marker { color: var(--graphite); }

.article a { text-underline-offset: 0.2em; }

/* Figures */

.figure { margin: 2rem 0 2.5rem; }

.figure img,
.figure video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}

.figure figcaption {
  margin-top: 0.6rem;
  font-size: 0.92rem;
  color: var(--graphite);
}

/* Small or tall images shouldn't fill the column */
.figure.narrow { max-width: 30rem; margin-inline: auto; }
.figure.tall img { width: auto; max-height: 80vh; margin-inline: auto; }

/* Diagrams drawn on white keep a white plate in both themes */
.figure.plate img { background: #fff; padding: clamp(0.5rem, 2vw, 1.25rem); }

.figure-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: center;
}

.embed {
  aspect-ratio: var(--ratio, 16 / 9);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--rule);
}

.embed iframe { display: block; width: 100%; height: 100%; border: 0; }

/* Collapsible extras (graphs, fallback renders) */

.more { margin: 1.5rem 0 2rem; }

.more summary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0 1.1rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}

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

.more summary::before {
  content: "+";
  font-weight: 700;
  color: var(--signal);
}

.more[open] summary::before { content: "\2212"; }
.more summary:hover { border-color: var(--ink); }

/* Links out and back */

.project-actions { margin: 2.5rem 0 0; }

.back-link {
  display: inline-block;
  margin-top: 2.5rem;
  color: var(--graphite);
  text-decoration: none;
}

.back-link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 0.25em; }

/* Next / previous project */

.project-nav {
  display: grid;
  gap: 1.25rem;
  padding: clamp(2rem, 5vw, 3rem) 0 clamp(3rem, 8vw, 5rem);
  border-top: 1px solid var(--rule);
}

.project-next {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: clamp(1.25rem, 4vw, 2.5rem);
  align-items: center;
  text-decoration: none;
}

.project-next img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
}

.project-next-text { display: grid; gap: 0.4rem; }

.project-next-title {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  line-height: 1;
}

.project-next:hover .project-next-title {
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 0.12em;
}

.project-prev {
  justify-self: start;
  color: var(--graphite);
  text-decoration: none;
}

.project-prev:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 0.25em; }

@media (max-width: 760px) {
  .project-cover { aspect-ratio: 4 / 3; }
  .figure-pair { gap: 0.5rem; }
  .project-next { grid-template-columns: minmax(0, 1fr); }
}
