/* ==========================================================================
   Projects grid (overrides/projects.html) and project detail (project.html)
   Inherits the .pf colour tokens from portfolio.css.
   ========================================================================== */

/* --- shared sub-page hero ------------------------------------------------- */

.pf-hero--sub .pf-eyebrow a {
  color: var(--pf-faint);
  border-bottom: 1px solid transparent;
}

.pf-hero--sub .pf-eyebrow a:hover {
  color: var(--pf-violet);
  border-bottom-color: var(--pf-violet);
}

.pf-name--sub {
  font-size: clamp(1.9rem, 6vw, 2.9rem);
}

.pf-thesis {
  max-width: 34rem;
  margin: 1.4rem 0 0;
  color: var(--pf-dim);
  font-family: var(--pf-serif);
  font-size: 1rem;
  line-height: 1.6;
}

/* Statuses beyond the two portfolio.css already defines. */
.pf-chip--complete { color: var(--pf-dim); }
.pf-chip--archived { color: var(--pf-faint); }

/* --- the grid ------------------------------------------------------------- */

.pj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 3rem 2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pj-cell {
  display: flex;
  flex-direction: column;
  text-align: center;
}

.pj-title {
  /* Two lines' worth, so every tile's art starts on the same baseline. */
  min-height: 2.6em;
  margin: 0 0 0.9rem;
  font-family: var(--pf-mono);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.pj-title a {
  color: var(--pf-fg);
}

.pj-title a:hover {
  color: var(--pf-violet);
}

.pj-title a:focus-visible {
  outline: 2px solid var(--pf-violet);
  outline-offset: 3px;
}

.pj-art {
  display: block;
  margin-bottom: 0.9rem;
}

.pj-status {
  margin: 0 0 0.45rem;
}

.pj-status .pf-chip {
  margin-left: 0;
}

.pj-tagline {
  margin: 0 0 0.35rem;
  color: var(--pf-dim);
  font-family: var(--pf-serif);
  font-size: 0.86rem;
  line-height: 1.45;
}

.pj-date {
  margin: 0;
  color: var(--pf-faint);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
}

/* --- preview box: every kind renders into the same rectangle -------------- */

.pv {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid var(--pf-line-strong);
  border-radius: 3px;
  background: #05060a;
  transition: border-color 0.16s ease;
}

[data-md-color-scheme="default"] .pv {
  background: #f6f6f8;
}

.pj-art:hover .pv {
  border-color: var(--pf-violet);
}

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

/* Code and terminal previews are deliberately clipped — they read as a
   screenshot of the thing rather than a scrollable snippet. */
.pv-code,
.pv-term {
  margin: 0;
  padding: 0.7rem 0.75rem;
  height: 100%;
  overflow: hidden;
  background: none;
  border: 0;
  font-family: var(--pf-mono);
  font-size: 0.5rem;
  line-height: 1.55;
  text-align: left;
  white-space: pre;
  color: var(--pf-dim);
}

.pv-code code,
.pv-term code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

/* Material's content.code.copy feature injects a clipboard button into every
   pre>code at runtime. These previews are artwork, not snippets to copy. */
.pv .md-clipboard {
  display: none !important;
}

/* python tokens */
.t-k { color: var(--pf-violet); }
.t-d { color: var(--pf-mint); }
.t-f { color: var(--pf-fg); }
.t-s { color: var(--pf-pink); }
.t-c { color: var(--pf-faint); font-style: italic; }
.t-a { color: var(--pf-dim); }
.t-p { color: var(--pf-faint); }
.t-n { color: var(--pf-dim); }
.t-t { color: var(--pf-mint); }

/* terminal tokens */
.t-pr { color: var(--pf-mint); }
.t-cm { color: var(--pf-fg); }
.t-ou { color: var(--pf-dim); }
.t-st { color: var(--pf-pink); }
.t-nu { color: var(--pf-violet); }
.t-di { color: var(--pf-faint); font-style: italic; }

/* pull-request preview */
.pv-prs {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
  height: 100%;
  margin: 0;
  padding: 0.8rem 0.85rem;
  list-style: none;
  text-align: left;
}

.pv-prs li {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  font-size: 0.52rem;
  line-height: 1.35;
}

.pv-pr-num {
  flex: none;
  color: var(--pf-mint);
  font-family: var(--pf-mono);
}

.pv-pr-text {
  color: var(--pf-dim);
  font-family: var(--pf-serif);
  font-size: 0.62rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* edit-chain preview (unreleased work with no artifact yet) */
.pv-chain {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.55rem;
  height: 100%;
  margin: 0;
  padding: 0.9rem 1rem;
  list-style: none;
  text-align: left;
  counter-reset: chain;
}

.pv-chain li {
  position: relative;
  padding-left: 0.9rem;
  border-left: 1px solid var(--pf-line-strong);
}

.pv-chain li::before {
  content: "";
  position: absolute;
  left: -3px;
  top: 0.42em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--pf-violet);
}

.pv-chain-label {
  display: block;
  color: var(--pf-fg);
  font-family: var(--pf-mono);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
}

.pv-chain-note {
  display: block;
  color: var(--pf-faint);
  font-family: var(--pf-serif);
  font-size: 0.6rem;
}

/* --- detail page ---------------------------------------------------------- */

.pj-meta-line {
  margin: 0.9rem 0 0;
  color: var(--pf-faint);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
}

.pj-hero-art {
  margin: 2.4rem 0 2rem;
}

/* On the detail page the preview is the headline image, so let it breathe and
   stop clipping. Only video keeps a fixed aspect — text previews size to their
   own content, otherwise short snippets leave a large empty box. */
.pj-hero-art .pv--video,
.pj-hero-art .pv--image {
  aspect-ratio: 16 / 9;
}

.pj-hero-art .pv--code,
.pj-hero-art .pv--term,
.pj-hero-art .pv--prs,
.pj-hero-art .pv--chain {
  aspect-ratio: auto;
}

.pj-hero-art .pv--code .pv-code,
.pj-hero-art .pv--term .pv-term,
.pj-hero-art .pv--prs .pv-prs,
.pj-hero-art .pv--chain .pv-chain {
  height: auto;
  overflow-x: auto;
}

.pj-hero-art .pv-code,
.pj-hero-art .pv-term {
  padding: 1.5rem 1.8rem;
  font-size: 0.72rem;
  line-height: 1.75;
}

.pj-hero-art .pv-prs {
  gap: 0.85rem;
  padding: 1.6rem 1.8rem;
}

.pj-hero-art .pv-prs li { font-size: 0.72rem; }
.pj-hero-art .pv-pr-text { font-size: 0.9rem; }

.pj-hero-art .pv-chain {
  gap: 1.1rem;
  padding: 1.8rem 2rem;
}

.pj-hero-art .pv-chain-label { font-size: 0.85rem; }
.pj-hero-art .pv-chain-note { font-size: 0.85rem; }

.pj-warn {
  padding: 1rem 1.2rem;
  border: 1px solid var(--pf-pink);
  border-radius: 3px;
  color: var(--pf-pink);
  font-size: 0.75rem;
}

/* --- prose body ----------------------------------------------------------- */

.pf-prose {
  max-width: 38rem;
  font-family: var(--pf-serif);
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--pf-dim);
}

.pf-prose h2 {
  margin: 2.2rem 0 0.8rem;
  color: var(--pf-fg);
  font-family: var(--pf-mono);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

/* toc.permalink adds a ¶ anchor to every heading; it reads as a typo next to
   these uppercase mono headings. */
.pf-prose .headerlink {
  display: none;
}

.pf-prose strong {
  color: var(--pf-fg);
}

.pf-prose a {
  color: var(--pf-fg);
  border-bottom: 1px solid var(--pf-line-strong);
}

.pf-prose a:hover {
  color: var(--pf-violet);
  border-bottom-color: var(--pf-violet);
}

.pf-prose code {
  padding: 0.1em 0.35em;
  border: 1px solid var(--pf-line);
  border-radius: 2px;
  background: none;
  color: var(--pf-fg);
  font-family: var(--pf-mono);
  font-size: 0.82em;
}

.pf-prose blockquote {
  margin: 1.4rem 0;
  padding-left: 1.1rem;
  border-left: 2px solid var(--pf-line-strong);
  color: var(--pf-faint);
  font-style: italic;
}

.pf-prose ul,
.pf-prose ol {
  padding-left: 1.2rem;
}

.pf-prose li {
  margin: 0.35rem 0;
}

/* --- responsive ----------------------------------------------------------- */

@media screen and (max-width: 44em) {
  .pj-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 2.5rem 0;
  }

  .pj-title {
    min-height: 0;
  }

  .pj-hero-art .pv-code,
  .pj-hero-art .pv-term {
    padding: 1rem 1.1rem;
    font-size: 0.58rem;
  }
}
