/* ---------------------------------------------------------------------------
   Joshtified - the project pages, one layer deeper.
   Additive only. Same Bricolage / Titan One / Silkscreen, same violet on the
   same chalk. Nothing in this file replaces a rule from site-2026.css: it adds
   a progress hairline, a machine readout for the facts, a proper way to look
   at a screenshot, and a dock that knows where you are on the page. Every rule
   is namespaced or scoped to .project-page so no other page can be affected.
   --------------------------------------------------------------------------- */

/* The reading hairline is already drawn by site.js in the header, so this file
   adds no second one. */

/* ---- a faint circuit plate behind the head, never over the words -------- */
@media (min-width: 960px) {
  .project-page-head { position: relative; }
  .project-page-head::after {
    content: "";
    position: absolute;
    top: 8%;
    right: 0;
    width: min(300px, 34%);
    height: 84%;
    pointer-events: none;
    background-image:
      linear-gradient(rgba(91, 33, 182, .13) 1px, transparent 1px),
      linear-gradient(90deg, rgba(91, 33, 182, .13) 1px, transparent 1px);
    background-size: 28px 28px;
    -webkit-mask-image: radial-gradient(ellipse at 70% 40%, #000 8%, transparent 72%);
    mask-image: radial-gradient(ellipse at 70% 40%, #000 8%, transparent 72%);
    opacity: .55;
    animation: pj-drift 26s linear infinite;
  }
}
@keyframes pj-drift {
  from { background-position: 0 0, 0 0; }
  to   { background-position: 28px 28px, 28px 28px; }
}

/* ---- facts, as a readout ------------------------------------------------ */
/* The labels become a micro-label in the pixel face the site already uses and
   the rows get a hairline, so the four facts read as a console rather than as
   four loose lines. The values keep the display face: they are the content. */
html.pj-js .project-page .project-case .facts {
  gap: 0 26px;
  padding-top: 4px;
  border-top: 1px solid var(--rule);
  border-bottom: 0;
}
html.pj-js .project-page .project-case .facts div {
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule-soft);
}
html.pj-js .project-page .project-case .facts span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--pixel);
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: .1em;
  text-transform: uppercase;
}
html.pj-js .project-page .project-case .facts span:first-child::before {
  content: "";
  width: 4px;
  height: 4px;
  flex: none;
  background: var(--violet);
  box-shadow: 0 0 0 3px rgba(91, 33, 182, .12);
}
html.pj-js .project-page .project-case .facts span:last-child {
  font-variant-numeric: tabular-nums;
  letter-spacing: -.005em;
}

/* ---- screenshots: a lens, not a picture --------------------------------- */
.project-page .project-case .shot {
  position: relative;
  isolation: isolate;
}
.project-page .project-case .shot img {
  transform: perspective(1000px) rotateX(var(--pj-rx, 0deg)) rotateY(var(--pj-ry, 0deg)) scale(var(--pj-zoom, 1));
  transform-origin: 50% 50%;
  transition: transform .5s var(--ease);
  will-change: transform;
}
.project-page .project-case .shot.is-tilt img { transition-duration: .14s; }
/* A single highlight that crosses the screenshot on hover, like a scan pass. */
.project-page .project-case .shot::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, .34) 50%, transparent 62%);
  background-size: 260% 100%;
  background-position: 180% 0;
  opacity: 0;
  transition: opacity .3s var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  .project-page .project-case .shot:hover::after,
  .project-page .project-case .shot:focus-within::after {
    opacity: 1;
    animation: pj-scan 1.1s var(--ease) 1;
  }
  .project-page .project-case .shot img { cursor: zoom-in; }
}
@keyframes pj-scan {
  from { background-position: 180% 0; }
  to   { background-position: -80% 0; }
}
/* The frame gets a violet edge on focus so a keyboard user can see the target. */
.project-page .project-case .shot:focus-within {
  border-color: rgba(91, 33, 182, .5);
  box-shadow: 0 0 0 3px rgba(91, 33, 182, .12), 0 16px 34px -26px rgba(40, 22, 55, .5);
}
.project-page .project-case .shot img:focus-visible { outline: 0; }

/* ---- the viewer -------------------------------------------------------- */
.pj-viewer {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  padding: clamp(14px, 2.4vw, 26px);
  background: rgba(12, 8, 22, .92);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #f4f1f9;
  animation: pj-fade .22s var(--ease);
}
.pj-viewer[hidden] { display: none; }
@keyframes pj-fade { from { opacity: 0; } to { opacity: 1; } }
.pj-viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.pj-viewer-count {
  font-family: var(--pixel);
  font-size: 11px;
  letter-spacing: .12em;
  color: rgba(244, 241, 249, .72);
}
.pj-viewer-bar button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(244, 241, 249, .22);
  border-radius: 999px;
  background: rgba(244, 241, 249, .06);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background .18s var(--ease), border-color .18s var(--ease);
}
.pj-viewer-bar button:hover { background: rgba(124, 58, 237, .34); border-color: rgba(244, 241, 249, .45); }
.pj-viewer-bar button svg { width: 17px; height: 17px; }
.pj-viewer-stage {
  min-height: 0;
  display: grid;
  place-items: center;
}
.pj-viewer-stage img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border: 1px solid rgba(244, 241, 249, .16);
  border-radius: var(--r-md);
  background: #0f0d16;
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, .9);
}
.pj-viewer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.pj-viewer-cap {
  margin: 0;
  max-width: 62ch;
  font-size: 14px;
  line-height: 1.55;
  color: rgba(244, 241, 249, .82);
}
.pj-viewer-move { display: flex; gap: 8px; flex: none; }
.pj-viewer-move button:disabled { opacity: .35; cursor: default; }
.pj-viewer-move button:disabled:hover { background: rgba(244, 241, 249, .06); border-color: rgba(244, 241, 249, .22); }
html.pj-locked, html.pj-locked body { overflow: hidden; }

@media (max-width: 640px) {
  .pj-viewer-foot { flex-direction: column; align-items: flex-start; }
  .pj-viewer-move { align-self: flex-end; }
}

/* ---- the dock: the way back and the way in, once the head is gone ------- */
.pj-dock {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 55;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 7px 7px 15px;
  border: 1px solid rgba(91, 33, 182, .22);
  border-radius: 999px;
  background: rgba(251, 249, 253, .93);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
  box-shadow: 0 18px 40px -22px rgba(40, 22, 55, .6);
  transform: translate(-50%, calc(100% + 26px));
  opacity: 0;
  pointer-events: none;
  transition: transform .46s var(--ease), opacity .3s ease;
}
.pj-dock.is-out {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}
.pj-dock-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--violet-bright);
  box-shadow: 0 0 0 0 rgba(124, 58, 237, .5);
  animation: pj-pulse 2.6s ease-out infinite;
}
@keyframes pj-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(124, 58, 237, .5); }
  70%  { box-shadow: 0 0 0 8px rgba(124, 58, 237, 0); }
  100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0); }
}
.pj-dock-name {
  font-family: var(--pixel);
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink);
  max-width: 16ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pj-dock-all {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}
.pj-dock-all:hover { color: var(--violet); border-bottom-color: rgba(91, 33, 182, .35); }
.pj-dock-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--violet);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background .18s var(--ease);
}
.pj-dock-cta:hover { background: var(--violet-bright); }
.pj-dock-cta svg { width: 14px; height: 14px; }
@media (max-width: 820px) { .pj-dock { display: none; } }

/* ---- the next project --------------------------------------------------
   Built from the listing on the home page, so it follows whatever the hub has
   published instead of a second copy of the project names in this file. */
.pj-next {
  margin: clamp(34px, 5vw, 58px) 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}
.pj-next-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 20px;
}
.pj-next-label {
  margin: 0;
  font-family: var(--pixel);
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.pj-next-label b {
  font-weight: 400;
  color: var(--violet);
}
.pj-next-prev {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}
.pj-next-prev:hover { color: var(--violet); border-bottom-color: rgba(91, 33, 182, .35); }

.pj-next-link {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 24px;
  margin-top: 14px;
  padding: 18px 20px;
  overflow: hidden;
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-md);
  background: linear-gradient(120deg, #fff, rgba(239, 233, 250, .72));
  text-decoration: none;
  color: inherit;
  transition: border-color .25s var(--ease), transform .35s var(--ease), box-shadow .3s var(--ease);
}
/* A violet spine that draws down the card as the pointer arrives. */
.pj-next-link::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--violet);
  transform: scaleY(0);
  transform-origin: 50% 0;
  transition: transform .35s var(--ease);
}
.pj-next-link:hover,
.pj-next-link:focus-visible {
  border-color: rgba(91, 33, 182, .32);
  transform: translateY(-2px);
  box-shadow: 0 18px 34px -28px rgba(40, 22, 55, .6);
}
.pj-next-link:hover::before,
.pj-next-link:focus-visible::before { transform: scaleY(1); }
.pj-next-name {
  grid-column: 1;
  font-family: var(--shout);
  font-weight: 400;
  font-size: clamp(24px, 3.6vw, 40px);
  line-height: 1.06;
  letter-spacing: .004em;
}
.pj-next-sum {
  grid-column: 1;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.55;
  max-width: 62ch;
}
.pj-next-go {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(91, 33, 182, .24);
  border-radius: 999px;
  color: var(--violet);
  transition: background .25s var(--ease), color .25s var(--ease), transform .35s var(--ease);
}
.pj-next-link:hover .pj-next-go,
.pj-next-link:focus-visible .pj-next-go {
  background: var(--violet);
  color: #fff;
  transform: translateX(3px);
}
.pj-next-go svg { width: 18px; height: 18px; }
@media (max-width: 560px) {
  .pj-next-link { grid-template-columns: minmax(0, 1fr); }
  .pj-next-go { display: none; }
}

/* ---- version history ---------------------------------------------------
   Build notes as a record, not a card: a rule, a pixel label, and one block
   per build with its file, its size and its checksum. The checksum reuses the
   download row's copy-on-click <details>, so a hash can be taken without
   dragging a selection. Only IronFrame carries a history today, so nothing
   here assumes it exists. */
.project-page .project-case .case-body > .pj-hist {
  order: 1;
  margin: 0 0 24px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}
.pj-hist-label {
  margin: 0 0 2px;
  font-family: var(--pixel);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--violet);
}
.pj-hist ol { list-style: none; margin: 0; padding: 0; }
.pj-hist li {
  padding: 13px 0 14px;
  border-bottom: 1px solid var(--rule-soft);
}
.pj-hist li:last-child { border-bottom: 0; padding-bottom: 0; }
.pj-hist li > p {
  margin: 0 0 7px;
  max-width: 54ch;
  font-size: 14px;
  line-height: 1.56;
  color: var(--ink-soft);
}
.pj-hist li > .pj-hist-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 3px 10px;
  margin: 0 0 7px;
}
.pj-hist-ver { font-family: var(--pixel); font-size: 13px; font-weight: 700; color: var(--ink); }
.pj-hist-when { font-size: 12px; color: var(--ink-faint); }
.pj-hist-now {
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--violet);
}
.pj-hist b { font-weight: 650; color: var(--ink); }
.pj-hist li > .pj-hist-file {
  margin: 8px 0 0;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-faint);
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.pj-hist .dl-hash { margin-top: 3px; }

/* ---- arrival: the body of the page comes up in a short stagger ---------- */
/* Only when JS is running, so a broken script can never leave an empty page. */
html.pj-js .project-page .pj-reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}
html.pj-js .project-page .pj-reveal.pj-shown {
  opacity: 1;
  transform: none;
}

/* ---- reduced motion: everything is simply there ------------------------- */
@media (prefers-reduced-motion: reduce) {
  .project-page-head::after { animation: none; }
  .pj-dock-dot { animation: none; }
  .project-page .project-case .shot::after { display: none; }
  .project-page .project-case .shot img { transition: none; }
  .pj-next-link:hover, .pj-next-link:focus-visible { transform: none; }
  html.pj-js .project-page .pj-reveal { opacity: 1; transform: none; transition: none; }
}
