/* ==========================================================================
   Projects page
   Featured project on a slate panel, then a filterable list of rows.
   Uses the shared theme tokens from theme.css; scoped under .pj-*.
   ========================================================================== */

/* The ground is now sand site-wide (theme.css), so this page no longer needs
   its own override; --pj-ground just tracks the shared token. */
.pj {
  --pj-ground: var(--vd-paper);
  background-color: var(--pj-ground);
}

.pj-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
}

.pj-eyebrow {
  font-family: var(--vd-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--vd-sand);
  margin: 0 0 16px;
}

/* --- hero -------------------------------------------------------------- */

.pj-hero {
  padding: 84px 0 56px;
  text-align: center;
}

.pj-hero h1 {
  font-family: var(--vd-display);
  font-variation-settings: "wdth" 112;
  font-weight: 700;
  font-size: clamp(2.2rem, 4.6vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -.02em;
  color: var(--vd-ink);
  margin: 0 auto;
  max-width: 22ch;
}

/* teal rather than sand: sand is too light for display text on paper */
.pj-hero h1 em {
  font-style: normal;
  color: var(--vd-teal);
}

.pj-lede {
  margin: 22px auto 0;
  max-width: 60ch;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--vd-muted);
}

/* --- featured ---------------------------------------------------------- */

/* Warm espresso rather than the site's slate-teal, which read as green here.
   Scoped to this panel only — the nav, footer, contact and about panels keep
   the slate. The tokens are declared on the panel so children inherit them. */
.pj-featured {
  --pj-dark: #2a2420;
  --pj-dark-deep: #1f1b18;
  --pj-on-dark: #ece7e1;
  --pj-on-dark-muted: #b3a79d;

  display: grid;
  grid-template-columns: 1fr 1.15fr;
  border: 1px solid var(--vd-line);
  border-radius: 22px;
  overflow: hidden;
  background: var(--pj-dark);
  box-shadow: 0 1px 2px rgba(28, 42, 46, .04), 0 24px 48px -32px rgba(42, 36, 32, .24);
}

.pj-featured-body {
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  color: var(--pj-on-dark);
}

.pj-featured-body h2 {
  font-family: var(--vd-display);
  font-variation-settings: "wdth" 112;
  font-weight: 700;
  font-size: clamp(1.5rem, 2.3vw, 2rem);
  line-height: 1.1;
  letter-spacing: -.02em;
  color: #fff;
  margin: 0 0 16px;
  text-transform: none;
}

.pj-featured-body p {
  margin: 0;
  font-size: .9375rem;
  line-height: 1.65;
  color: var(--pj-on-dark-muted);
}

.pj-featured-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  justify-content: space-between;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid rgba(236, 231, 225, .2);
  font-family: var(--vd-mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.pj-featured-meta .pj-cat {
  color: var(--vd-sand);
}

.pj-featured-meta .pj-where {
  color: var(--pj-on-dark-muted);
}

.pj-featured-cta {
  margin-top: 30px;
}

.pj-media {
  position: relative;
  min-height: 320px;
  background: var(--pj-ground, #f4f1eb);
}

.pj-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* --- pill button with arrow -------------------------------------------- */

.pj-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  align-self: flex-start;
  padding: 7px 7px 7px 22px;
  border-radius: 999px;
  background: var(--vd-paper);
  color: var(--vd-ink);
  font-family: var(--vd-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color .18s ease, color .18s ease;
}

.pj-btn::after {
  content: "";
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  background-color: var(--vd-slate);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23f4f1eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17L17 7M9 7h8v8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  transition: transform .18s ease;
}

.pj-btn:hover {
  background: var(--vd-sand);
  color: #1c2a2e;
}

.pj-btn:hover::after {
  transform: translate(2px, -2px);
}

.pj-btn:focus-visible {
  outline: 2px solid var(--vd-teal);
  outline-offset: 3px;
}

/* dark variant, for rows on the paper background */
.pj-btn.is-dark {
  background: var(--vd-slate);
  color: var(--vd-paper);
}

.pj-btn.is-dark::after {
  background-color: var(--vd-paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%231c2a2e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17L17 7M9 7h8v8'/%3E%3C/svg%3E");
}

.pj-btn.is-dark:hover {
  background: var(--vd-slate-deep);
  color: var(--vd-paper);
}

.pj-btn.is-muted {
  background: transparent;
  color: var(--vd-muted);
  border-color: var(--vd-fill-line);
  cursor: default;
}

.pj-btn.is-muted::after {
  display: none;
}

.pj-btn.is-muted:hover {
  background: transparent;
  color: var(--vd-muted);
}

/* --- list section ------------------------------------------------------ */

.pj-list-section {
  padding: 76px 0 96px;
}

.pj-list-head h2 {
  font-family: var(--vd-display);
  font-variation-settings: "wdth" 112;
  font-weight: 700;
  font-size: clamp(1.6rem, 2.8vw, 2.2rem);
  line-height: 1.08;
  letter-spacing: -.02em;
  color: var(--vd-ink);
  margin: 0;
  max-width: 26ch;
  text-transform: none;
}

/* --- filters ----------------------------------------------------------- */

.pj-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 32px 0 8px;
  padding-top: 28px;
  border-top: 1px solid var(--vd-line);
}

.pj-filter {
  font-family: var(--vd-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .06em;
  color: var(--vd-ink);
  background: transparent;
  border: 1px solid var(--vd-fill-line);
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  transition: background-color .16s ease, color .16s ease, border-color .16s ease;
  -webkit-appearance: none;
  appearance: none;
}

.pj-filter:hover {
  border-color: var(--vd-sand);
}

.pj-filter[aria-pressed="true"] {
  background: var(--vd-slate);
  border-color: var(--vd-slate);
  color: var(--vd-paper);
}

.pj-filter:focus-visible {
  outline: 2px solid var(--vd-teal);
  outline-offset: 2px;
}

.pj-count {
  font-family: var(--vd-mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--vd-muted);
  margin: 22px 0 0;
}

/* --- rows -------------------------------------------------------------- */

.pj-rows {
  margin-top: 8px;
}

.pj-row {
  display: grid;
  grid-template-columns: 1fr 1.15fr .9fr;
  gap: 40px;
  align-items: start;
  padding: 34px 0;
  border-top: 1px solid var(--vd-line);
}

.pj-row:last-child {
  border-bottom: 1px solid var(--vd-line);
}

.pj-row[hidden] {
  display: none;
}

.pj-cat {
  font-family: var(--vd-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--vd-sand);
  margin: 0 0 10px;
}

.pj-row h3 {
  font-family: var(--vd-display);
  font-variation-settings: "wdth" 112;
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.2;
  letter-spacing: -.015em;
  color: var(--vd-ink);
  margin: 0;
  text-transform: none;
}

.pj-row-meta {
  margin: 16px 0 0;
  font-family: var(--vd-mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--vd-muted);
}

.pj-row p.pj-row-desc {
  margin: 0 0 22px;
  font-size: .9375rem;
  line-height: 1.65;
  color: var(--vd-muted);
}

.pj-row-thumb {
  display: block;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 16 / 11;
  background: var(--vd-fill);
  border: 1px solid var(--vd-line);
}

.pj-row-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}

.pj-row-thumb:hover img {
  transform: scale(1.03);
}

.pj-empty {
  padding: 44px 0;
  border-top: 1px solid var(--vd-line);
  color: var(--vd-muted);
  font-size: .9375rem;
}

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

@media screen and (max-width: 991px) {
  .pj-featured {
    grid-template-columns: 1fr;
  }

  .pj-media {
    min-height: 260px;
    order: -1;
  }

  .pj-row {
    grid-template-columns: 1fr 1fr;
  }

  .pj-row-thumb {
    grid-column: 1 / -1;
    grid-row: 1;
    max-width: 420px;
  }
}

@media screen and (max-width: 640px) {
  .pj-wrap {
    padding: 0 20px;
  }

  .pj-hero {
    padding: 56px 0 40px;
  }

  .pj-featured-body {
    padding: 28px 22px;
  }

  .pj-list-section {
    padding: 52px 0 64px;
  }

  .pj-row {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .pj-row-thumb {
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pj-btn,
  .pj-btn::after,
  .pj-filter,
  .pj-row-thumb img {
    transition-duration: .01ms;
  }

  .pj-row-thumb:hover img {
    transform: none;
  }
}

/* the featured panel CTA arrow follows the panel colour, not the site slate */
.pj-featured .pj-btn::after {
  background-color: var(--pj-dark);
}

.pj-featured .pj-btn:hover {
  background: var(--vd-sand);
}

/* --------------------------------------------------------------------------
   Motion
   One orchestrated load sequence, then restrained scroll reveals.

   Same safety inversion used in home.css: the default state below is fully
   visible, so no-JS (or a JS error) means "no animation", never "no content".
   Everything is hidden only under html.pj-ready — a class the page script adds
   once it is confirmed running — and only while an element is still waiting.
   Under prefers-reduced-motion the class is never added at all.

   The signature is the row rule: it draws left to right in sand as the row
   arrives, then fades out, leaving the ordinary hairline behind. On a page
   whose language is measured drawings, a line being plotted is the right
   gesture; nothing else needs to move much.
   -------------------------------------------------------------------------- */

.pj-row {
  position: relative;
}

html.pj-ready .pj-anim {
  opacity: 0;
  transform: translate3d(0, 14px, 0);
}

html.pj-ready .pj-anim.is-in {
  opacity: 1;
  transform: none;
  transition: opacity .55s ease, transform .65s cubic-bezier(.22, .61, .36, 1);
}

/* the load sequence: hero parts arrive in reading order */
html.pj-ready .pj-d1.is-in { transition-delay: .04s; }
html.pj-ready .pj-d2.is-in { transition-delay: .12s; }
html.pj-ready .pj-d3.is-in { transition-delay: .20s; }
html.pj-ready .pj-d4.is-in { transition-delay: .30s; }

/* the featured render settles rather than sliding */
html.pj-ready .pj-featured .pj-media img {
  transform: scale(1.05);
  opacity: 0;
}

html.pj-ready .pj-featured.is-in .pj-media img {
  transform: none;
  opacity: 1;
  transition: transform 1.1s cubic-bezier(.22, .61, .36, 1) .18s,
              opacity .8s ease .18s;
}

/* signature: the row rule plots itself, then hands over to the hairline */
html.pj-ready .pj-row::after {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--vd-sand);
  transform: scaleX(0);
  transform-origin: left center;
  pointer-events: none;
}

html.pj-ready .pj-row.is-in::after {
  transform: scaleX(1);
  opacity: 0;
  transition: transform .8s cubic-bezier(.22, .61, .36, 1),
              opacity .6s ease .75s;
}

/* filter chips arrive as a group, staggered by index */
html.pj-ready .pj-filter {
  opacity: 0;
  transform: translate3d(0, 8px, 0);
}

html.pj-ready .pj-filters.is-in .pj-filter {
  opacity: 1;
  transform: none;
  transition: opacity .4s ease, transform .45s cubic-bezier(.22, .61, .36, 1);
}

html.pj-ready .pj-filters.is-in .pj-filter:nth-child(1) { transition-delay: .02s; }
html.pj-ready .pj-filters.is-in .pj-filter:nth-child(2) { transition-delay: .07s; }
html.pj-ready .pj-filters.is-in .pj-filter:nth-child(3) { transition-delay: .12s; }
html.pj-ready .pj-filters.is-in .pj-filter:nth-child(4) { transition-delay: .17s; }

/* Filtering gets its own short settle. Driven by a class the filter script
   adds and then strips — not a blanket rule on :not([hidden]), which would
   also fire on page load and, being an animation, would override the
   scroll-reveal transform above. */
@media (prefers-reduced-motion: no-preference) {
  .pj-row.pj-pop {
    animation: pj-settle .32s ease both;
  }

  @keyframes pj-settle {
    from { opacity: .4; transform: translate3d(0, 5px, 0); }
    to   { opacity: 1; transform: none; }
  }
}
