/* =====================================================================
   Projects: /projects listing + /projects/<slug> detail (pj- prefix)
   Builds on proj-card / hx- styles from styles.css.
   ===================================================================== */

/* ---------- Listing header ---------- */
.pj-head { padding-top: 20px; padding-bottom: 10px; }
.pj-head .h1 { margin-top: 10px; }
.pj-lead { margin-top: 16px; max-width: 760px; }
.pj-see { margin-top: 12px; max-width: 760px; font: 400 16px/1.5 var(--f-inter); color: var(--ink-soft); }

/* ---------- Filters ---------- */
.pj-listing { padding-top: 30px; padding-bottom: 70px; scroll-margin-top: 100px; }
.pj-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.pj-fbtn { display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 20px; box-shadow: inset 0 0 0 1px #222; font: 600 18px/1 var(--f-dg); letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink); background: transparent; transition: background .2s, color .2s; }
.pj-fbtn span { font: 500 13px/1 var(--f-inter); letter-spacing: 0; opacity: .6; }
.pj-fbtn:hover { background: rgba(35, 35, 35, 0.06); }
.pj-fbtn.on { background: var(--ink); color: #fafafa; }
.pj-fbtn:focus-visible { outline: 2px solid var(--red-bright); outline-offset: 2px; }
.pj-count { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Grid of cards (homepage proj-card look) ---------- */
.pj-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 30px; }
.pj-card { height: 330px; }
.pj-card[hidden] { display: none; }
.pj-card .proj-top { gap: 18px; flex-wrap: wrap; height: auto; min-height: 76px; }
.pj-card .hx-proj-bottom h3 { font-size: 19px; }

/* Darker gradient + bottom-left title for legibility over busy photos */
.pj-card .proj-bottom.hx-proj-bottom { align-items: flex-start; justify-content: flex-end; text-align: left; padding: 0 18px 16px; background: linear-gradient(180deg, rgba(10, 10, 10, 0) 0%, rgba(8, 8, 8, 0.55) 45%, rgba(4, 4, 4, 0.94) 100%); }
.pj-card .proj-bottom.hx-proj-bottom h3, .pj-card .proj-bottom.hx-proj-bottom p { text-align: left; }

/* Subhead above the rendering-only ADUs at the end of the grid */
.pj-subhead { grid-column: 1 / -1; margin: 10px 0 -6px; font: 600 15px/1.2 var(--f-dg); letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-soft); }
.pj-subhead[hidden] { display: none; }
.pj-more, .pj-note { margin-top: 40px; font: 400 16px/1.5 var(--f-inter); color: var(--ink-soft); max-width: 760px; }
.pj-note { margin-top: 0; margin-bottom: 10px; }
.pj-more a, .pj-note a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.pj-more a:hover, .pj-note a:hover { color: var(--red-bright); }

/* Rendering tag: light chip so it reads as a label, not as a category */
.pj-rtag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; background: #fafafa; color: var(--ink); font: 600 14px/1 var(--f-dg); letter-spacing: 0.06em; text-transform: uppercase; }
.proj-top .pj-rtag { margin-left: auto; }
.pj-rtag-img { position: absolute; top: 12px; left: 12px; z-index: 1; pointer-events: none; box-shadow: 0 1px 4px rgba(0,0,0,.2); }

/* ---------- Detail: hero ---------- */
.pj-dhero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-areas: "head img" "text img"; column-gap: 60px; align-items: start; padding-top: 10px; padding-bottom: 40px; }
.pj-dcopy { grid-area: head; align-self: end; }
.pj-dtext { grid-area: text; }
.pj-dimg { grid-area: img; position: relative; margin: 0; }
.pj-dimg img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; background: var(--off); }
.pj-crumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; font: 400 14px/1.3 var(--f-inter); color: var(--ink-soft); }
.pj-crumbs a { color: var(--ink-soft); }
.pj-crumbs a:hover { color: var(--red-bright); text-decoration: underline; }
.pj-dhero .h1 { margin-top: 10px; font-size: 40px; }
.pj-dspec { margin-top: 14px; font: 600 22px/1.2 var(--f-dg); letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink); }
.pj-dp { margin-top: 16px; font-size: 17px; line-height: 1.55; max-width: 560px; }
.pj-dtext .pj-dp:first-child { margin-top: 22px; }
.pj-rnote { display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; max-width: 560px; font: 400 14px/1.5 var(--f-inter); color: var(--ink-soft); }
.pj-rnote .pj-rtag { flex: none; background: var(--ink); color: #fafafa; margin-top: 1px; }
.pj-dactions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* ---------- Detail: facts strip ---------- */
.pj-facts { padding-top: 10px; padding-bottom: 30px; }
.pj-facts dl { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 220px)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pj-facts dl > div { padding: 18px 20px; border-left: 1px solid var(--line); }
.pj-facts dl > div:first-child { border-left: 0; padding-left: 0; }
.pj-facts dt { font: 600 15px/1.2 var(--f-dg); letter-spacing: 0.05em; text-transform: uppercase; color: var(--red-bright); }
.pj-facts dd { margin: 6px 0 0; font: 500 22px/1.2 var(--f-dm); letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink); }

/* ---------- Detail: highlights ---------- */
.pj-hl { padding-top: 40px; padding-bottom: 20px; }
.pj-hl-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 40px; max-width: 980px; margin-top: 24px; }
.pj-hl-list p { font-size: 17px; line-height: 1.45; }
.pj-hl-list svg { width: 26px; height: 26px; }

/* ---------- Detail: gallery ---------- */
.pj-gal-sec { padding-top: 40px; padding-bottom: 60px; scroll-margin-top: 90px; }
.pj-gal { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 24px; }
.pj-gi { position: relative; margin: 0; overflow: hidden; background: var(--off); }
.pj-gi a { display: block; }
.pj-gi img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .5s ease; }
.pj-gi a:hover img { transform: scale(1.04); }
.pj-gi a:focus-visible { outline: 2px solid var(--red-bright); outline-offset: 2px; }

/* ---------- Detail: more projects ---------- */
.pj-others { padding-top: 40px; padding-bottom: 60px; }

/* ---------- Lightbox ---------- */
.pj-lb { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(12, 12, 12, 0.94); color: #fafafa; }
.pj-lb[open] { display: flex; align-items: center; justify-content: center; }
.pj-lb::backdrop { background: rgba(0, 0, 0, 0.6); }
.pj-lb img { max-width: calc(100vw - 140px); max-height: calc(100vh - 110px); object-fit: contain; }
.pj-lb-cap { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; font: 400 14px/1.3 var(--f-inter); color: rgba(250,250,250,.8); }
.pj-lb button { position: absolute; display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; border: 0; background: rgba(250,250,250,.12); color: #fafafa; cursor: pointer; }
.pj-lb button:hover { background: rgba(250,250,250,.25); }
.pj-lb button svg { width: 22px; height: 22px; fill: currentColor; }
.pj-lb-x { top: 16px; right: 16px; }
.pj-lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.pj-lb-next { right: 16px; top: 50%; transform: translateY(-50%); }

/* ---------- Tablet ---------- */
@media (max-width: 1199px) {
  .pj-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pj-dhero { column-gap: 40px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pj-dhero .h1 { font-size: 34px; }
  .pj-gal { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Phone ---------- */
@media (max-width: 809px) {
  .pj-head { padding-top: 36px; }
  .pj-lead, .pj-see, .pj-more, .pj-note { font-size: 17px; }
  .pj-listing { padding-top: 24px; padding-bottom: 50px; }
  .pj-fbtn { height: 44px; padding: 0 14px; font-size: 17px; }
  .pj-grid { grid-template-columns: 1fr; gap: 14px; margin-top: 20px; }
  .pj-card { height: 280px; }

  .pj-dhero { grid-template-columns: 1fr; grid-template-areas: "head" "img" "text"; padding-top: 24px; padding-bottom: 24px; }
  .pj-crumbs { margin-bottom: 14px; }
  .pj-dhero .h1 { font-size: 28px; }
  .pj-dspec { font-size: 20px; }
  .pj-dimg { margin-top: 22px; }
  .pj-dp, .pj-rnote { font-size: 17px; }
  .pj-rnote { font-size: 15px; }
  .pj-dactions { flex-direction: column; align-items: stretch; }
  .pj-dactions .btn { width: 100%; }

  .pj-facts { padding-bottom: 20px; }
  .pj-facts dl { display: block; border-bottom: 0; }
  .pj-facts dl > div, .pj-facts dl > div:first-child { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 0; border-left: 0; border-bottom: 1px solid var(--line); }
  .pj-facts dd { margin: 0; text-align: right; }
  .pj-facts dd { font-size: 19px; }

  .pj-hl { padding-top: 24px; }
  .pj-hl-list { grid-template-columns: 1fr; gap: 14px; margin-top: 18px; }
  .pj-gal-sec { padding-top: 24px; padding-bottom: 40px; }
  .pj-gal { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 18px; }
  .pj-others { padding-top: 24px; padding-bottom: 40px; }
  .pj-others .projects-head { flex-direction: column; align-items: flex-start; gap: 16px; }

  .pj-lb img { max-width: 100vw; max-height: calc(100vh - 140px); }
  .pj-lb-prev, .pj-lb-next { top: auto; bottom: 48px; transform: none; }
  .pj-lb-cap { bottom: 64px; }
}
.pj-note { margin-top: 6px; font: 400 15px/1.4 var(--f-inter); color: var(--ink-soft); }
.pj-ref { margin-top: 14px; font: 500 16px/1.4 var(--f-inter); color: var(--ink); }

/* Listing subheads: built ADUs / rendering ADUs / full home remodels */
html.v2 .pj-subhead-gap { margin-top: 34px; padding-top: 24px; border-top: 1px solid var(--line); }
html.v2 .pj-subnote { display: block; margin-top: 6px; font: 400 15px/1.4 var(--f-inter); letter-spacing: 0; text-transform: none; color: var(--ink-soft); }
html.v2 .pj-dtext .pj-space { margin-top: 18px; max-width: 560px; font-size: 16px; }
@media (max-width: 809px) {
  html.v2 .pj-subhead-gap { margin-top: 20px; padding-top: 18px; }
}

/* Desktop: wide cards fill the last row of each group (lib/projects.py mark_wide) */
@media (min-width: 1200px) {
  html.v2 .pj-grid .pj-card.pj-wide { grid-column: span 2; }
}
