/* Xeon NC — homepage parts gallery.
   Mosaic of real parts, each set on a dark drawing sheet (zone strips, drafting grid,
   corner marks). Hovering a tile "dimensions" the part: grid, center lines, extents,
   dimension lines, title block, and a cursor locator that lights the zone underneath.
   Markup lives in index.html (#parts-gallery); parts-gallery.js adds the drawing layer. */

#parts-gallery {
  --pg-bg: #1f2225;
  --pg-line: rgba(255, 255, 255, 0.07);
  --pg-line-mid: rgba(255, 255, 255, 0.14);
  --pg-line-strong: rgba(255, 255, 255, 0.3);
  --pg-ink: rgba(255, 255, 255, 0.66);
  --pg-label: rgba(255, 255, 255, 0.52);
  --pg-accent: #60a5fa;
  --pg-mono: 'Share Tech Mono', ui-monospace, Menlo, Consolas, monospace;
  --pg-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --pg-gap: 16px;

  background: #fff;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
  padding: 120px 0 104px;
}

.pg-head {
  max-width: 720px;
  margin: 0 auto 56px;
  text-align: center;
}
.pg-head .section-label { color: #888; margin-bottom: 16px; }
.pg-head h2 { color: #111; margin: 0; }
.pg-deck {
  margin: 22px auto 0;
  max-width: 560px;
  font-size: 15px;
  line-height: 1.65;
  color: #5d636b;
}
.pg-browse { margin: 18px 0 0; font-size: 14px; }
.pg-browse a { color: #224ca0; text-underline-offset: 4px; }
.pg-browse a:focus-visible { outline: 2px solid #245cd6; outline-offset: 5px; }

/* ─── Mosaic ─── */
.pg-wrap { container-type: inline-size; }

.pg-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: calc((100cqw - 3 * var(--pg-gap)) / 4);
  grid-template-areas:
    "a b H H"
    "c d H H"
    "R R e f"
    "R R W W";
  gap: var(--pg-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}
.pg-list > li { min-width: 0; min-height: 0; }
.pg-list > :nth-child(1) { grid-area: a; }
.pg-list > :nth-child(2) { grid-area: b; }
.pg-list > :nth-child(3) { grid-area: c; }
.pg-list > :nth-child(4) { grid-area: d; }
.pg-list > :nth-child(5) { grid-area: H; }
.pg-list > :nth-child(6) { grid-area: R; }
.pg-list > :nth-child(7) { grid-area: e; }
.pg-list > :nth-child(8) { grid-area: f; }
.pg-list > :nth-child(9) { grid-area: W; }

@container (max-width: 720px) {
  .pg-list {
    --pg-gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: calc((100cqw - var(--pg-gap)) / 2);
    grid-template-areas:
      "a b" "c d" "H H" "H H" "e f" "R R" "R R" "W W";
  }
}

/* ─── Tile: one drawing sheet ─── */
.pg-tile {
  --z: 22px;          /* zone strip thickness */
  --cols: 4;
  --rows: 4;
  --mx: -100px;
  --my: -100px;
  position: relative;
  height: 100%;
  margin: 0;
  background: var(--pg-bg);
  overflow: hidden;
  isolation: isolate;
  font-family: var(--pg-mono);
  color: var(--pg-label);
  -webkit-tap-highlight-color: transparent;
}

/* zone strips: column numbers across the top, row letters down the left */
.pg-zones {
  position: absolute;
  display: flex;
  font-size: 10px;
  letter-spacing: 0.04em;
  line-height: 1;
}
.pg-zones span {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background-color 0.2s;
}
.pg-zones--x {
  top: 0;
  left: var(--z);
  right: 0;
  height: var(--z);
  border-bottom: 1px solid var(--pg-line-mid);
}
.pg-zones--x span + span { border-left: 1px solid var(--pg-line-mid); }
.pg-zones--y {
  top: var(--z);
  left: 0;
  bottom: 0;
  width: var(--z);
  flex-direction: column;
  border-right: 1px solid var(--pg-line-mid);
}
.pg-zones--y span + span { border-top: 1px solid var(--pg-line-mid); }
.pg-corner {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--z);
  height: var(--z);
  border-right: 1px solid var(--pg-line-mid);
  border-bottom: 1px solid var(--pg-line-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-style: normal;
  letter-spacing: 0;
  color: var(--pg-accent);
}
.pg-zones span.is-on {
  color: var(--pg-accent);
  background-color: rgba(96, 165, 250, 0.14);
}

/* drawing area */
.pg-sheet {
  position: absolute;
  inset: var(--z) 0 0 var(--z);
  overflow: hidden;
}

/* zone grid always faint; 5-way subdivision fades in on hover */
.pg-grid,
.pg-grid-fine {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.pg-grid {
  background-image:
    linear-gradient(90deg, var(--pg-line) 1px, transparent 1px),
    linear-gradient(var(--pg-line) 1px, transparent 1px);
  background-size: calc(100% / var(--cols)) calc(100% / var(--rows));
}
.pg-grid-fine {
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: calc(100% / var(--cols) / 5) calc(100% / var(--rows) / 5);
  opacity: 0;
  transition: opacity 0.5s var(--pg-ease);
}

/* registration crosses at the right-hand corners */
.pg-mark {
  position: absolute;
  right: 14px;
  width: 22px;
  height: 22px;
  pointer-events: none;
}
.pg-mark::before,
.pg-mark::after {
  content: '';
  position: absolute;
  background: var(--pg-ink);
}
.pg-mark::before { left: 50%; top: 0; width: 1.5px; height: 100%; transform: translateX(-50%); }
.pg-mark::after  { top: 50%; left: 0; height: 1.5px; width: 100%; transform: translateY(-50%); }
.pg-mark--tr { top: 14px; }
.pg-mark--br { bottom: 14px; }

/* cursor locator lines */
.pg-cursor-x,
.pg-cursor-y {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
  z-index: 1;
}
.pg-cursor-x {
  width: 100%;
  height: 1px;
  transform: translate3d(0, var(--my), 0);
  background: repeating-linear-gradient(90deg, rgba(96, 165, 250, 0.75) 0 6px, transparent 6px 10px);
}
.pg-cursor-y {
  width: 1px;
  height: 100%;
  transform: translate3d(var(--mx), 0, 0);
  background: repeating-linear-gradient(rgba(96, 165, 250, 0.75) 0 6px, transparent 6px 10px);
}

/* ─── The part ─── */
.pg-stage {
  position: absolute;
  inset: 12% 17% 21% 11%;
  display: grid;
  place-items: center;
  container-type: size;
}
.pg-fig {
  --ar: 1;
  position: relative;
  aspect-ratio: var(--ar);
  width: min(100cqw, 100cqh * var(--ar));
}
.pg-fig img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.35));
  transition: transform 0.7s var(--pg-ease), filter 0.7s var(--pg-ease);
}

/* center lines (chain line), drawn under the part so they read through its holes */
.pg-cl {
  position: absolute;
  z-index: 0;
  pointer-events: none;
  transition: transform 0.6s var(--pg-ease);
}
.pg-cl--h {
  left: -22px;
  right: -22px;
  top: 50%;
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--pg-line-strong) 0 16px, transparent 16px 20px, var(--pg-line-strong) 20px 23px, transparent 23px 27px);
  transform: scaleX(0);
}
.pg-cl--v {
  top: -22px;
  bottom: -22px;
  left: 50%;
  width: 1px;
  background: repeating-linear-gradient(var(--pg-line-strong) 0 16px, transparent 16px 20px, var(--pg-line-strong) 20px 23px, transparent 23px 27px);
  transform: scaleY(0);
}

/* extent brackets */
.pg-br {
  position: absolute;
  z-index: 2;
  width: 12px;
  height: 12px;
  border: 0 solid var(--pg-ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.5s var(--pg-ease);
}
.pg-br--tl { top: -9px; left: -9px; border-top-width: 1px; border-left-width: 1px; transform: translate(-8px, -8px); }
.pg-br--tr { top: -9px; right: -9px; border-top-width: 1px; border-right-width: 1px; transform: translate(8px, -8px); }
.pg-br--bl { bottom: -9px; left: -9px; border-bottom-width: 1px; border-left-width: 1px; transform: translate(-8px, 8px); }
.pg-br--br { bottom: -9px; right: -9px; border-bottom-width: 1px; border-right-width: 1px; transform: translate(8px, 8px); }

/* dimension lines: extension lines + arrowed dimension line + note */
.pg-ext {
  position: absolute;
  z-index: 2;
  border: 0 solid var(--pg-line-strong);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
}
.pg-ext--x { left: 0; right: 0; bottom: calc(100% + 6px); height: 20px; border-left-width: 1px; border-right-width: 1px; }
.pg-ext--y { top: 0; bottom: 0; left: calc(100% + 6px); width: 20px; border-top-width: 1px; border-bottom-width: 1px; }

.pg-dim {
  position: absolute;
  z-index: 2;
  background: var(--pg-ink);
  pointer-events: none;
  transition: transform 0.6s var(--pg-ease);
}
.pg-dim::before,
.pg-dim::after {
  content: '';
  position: absolute;
  border: 3px solid transparent;
}
.pg-dim--x { left: 0; right: 0; bottom: calc(100% + 20px); height: 1px; transform: scaleX(0); }
.pg-dim--x::before { left: 0; top: -3px; border-right: 9px solid var(--pg-ink); border-left: 0; }
.pg-dim--x::after  { right: 0; top: -3px; border-left: 9px solid var(--pg-ink); border-right: 0; }
.pg-dim--y { top: 0; bottom: 0; left: calc(100% + 20px); width: 1px; transform: scaleY(0); }
.pg-dim--y::before { top: 0; left: -3px; border-bottom: 9px solid var(--pg-ink); border-top: 0; }
.pg-dim--y::after  { bottom: 0; left: -3px; border-top: 9px solid var(--pg-ink); border-bottom: 0; }
.pg-dim b {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 0 6px;
  background: var(--pg-bg);
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--pg-ink);
  white-space: nowrap;
}

/* title block */
.pg-title {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 3;
  display: grid;
  grid-template-columns: auto 1fr;
  max-width: calc(100% - 66px);
  border: 1px solid var(--pg-line-strong);
  background: rgba(31, 34, 37, 0.92);
  font-size: 10px;
  line-height: 1.25;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.45s var(--pg-ease);
}
.pg-title > span {
  padding: 6px 8px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pg-title .pg-no {
  grid-row: span 2;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--pg-line-strong);
  color: var(--pg-accent);
}
.pg-title .pg-name { color: #fff; border-bottom: 1px solid var(--pg-line-mid); }
.pg-title .pg-spec { display: none; } /* shown in the pop-up; kept in the markup as its source */
.pg-title .pg-more { color: var(--pg-accent); }

/* Real link to part details; parts-gallery.js enhances an ordinary click into a dialog. */
.pg-open {
  position: absolute;
  inset: 0;
  z-index: 6;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.pg-link-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.pg-open:focus-visible { outline: 2px solid var(--pg-accent); outline-offset: -2px; }

/* ─── Drawing state (hover, keyboard focus, or open in the pop-up) ─── */
.pg-tile:is(:hover, :focus-within, .is-active) .pg-grid-fine { opacity: 1; }
.pg-tile:is(:hover, :focus-within, .is-active) .pg-fig img {
  transform: translateY(-3%) scale(1.045);
  filter: drop-shadow(0 22px 26px rgba(0, 0, 0, 0.5));
}
.pg-tile:is(:hover, :focus-within, .is-active) .pg-cl { transform: none; transition-delay: 0.05s; }
.pg-tile:is(:hover, :focus-within, .is-active) .pg-br { opacity: 1; transform: none; transition-delay: 0.12s; }
.pg-tile:is(:hover, :focus-within, .is-active) .pg-ext { opacity: 1; transition-delay: 0.18s; }
.pg-tile:is(:hover, :focus-within, .is-active) .pg-dim { transform: none; transition-delay: 0.22s; }
.pg-tile:is(:hover, :focus-within, .is-active) .pg-title { opacity: 1; transform: none; transition-delay: 0.28s; }
.pg-tile:hover .pg-cursor-x,
.pg-tile:hover .pg-cursor-y { opacity: 1; }

/* ─── Sizes ─── */
.pg-tile--big { --z: 26px; }
.pg-tile--big .pg-stage { inset: 11% 14% 18% 10%; }
.pg-tile--big .pg-zones,
.pg-tile--big .pg-title { font-size: 11px; }
.pg-tile--wide .pg-stage { inset: 15% 15% 25% 9%; }

.pg-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.09);
}
.pg-foot p {
  margin: 0;
  font-family: var(--pg-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7b8188;
}
.pg-foot a {
  flex: none;
  display: inline-block;
  padding: 12px 26px;
  background: #111;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.2s;
}
.pg-foot a:hover { background: #333; }

/* ─── Part pop-up ─── */
html.pg-lock { overflow: hidden; }

.pgm {
  width: min(1080px, calc(100vw - 48px));
  max-width: none;
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--pg-line-strong);
  background: #16181b;
  color: #fff;
  font-family: 'Inter', system-ui, sans-serif;
}
.pgm[open] { animation: pgm-in 0.4s var(--pg-ease); }
.pgm-frame:focus { outline: none; }
.pgm::backdrop {
  background: rgba(8, 9, 11, 0.78);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
@keyframes pgm-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

.pgm-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px 10px 20px;
  background: #16181b;
  border-bottom: 1px solid var(--pg-line-mid);
  font-family: var(--pg-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--pg-label);
}
.pgm-nav { display: flex; gap: 6px; }
.pgm-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--pg-line-strong);
  background: transparent;
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.pgm-btn:hover { background: rgba(96, 165, 250, 0.16); border-color: var(--pg-accent); }
.pgm-btn:focus-visible { outline: 2px solid var(--pg-accent); outline-offset: 2px; }
.pgm-close { font-size: 20px; margin-left: 6px; }

.pgm-body {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  border-bottom: 1px solid var(--pg-line-mid);
}
.pgm-drawing { border-right: 1px solid var(--pg-line-mid); }
.pgm-drawing .pg-tile { height: auto; aspect-ratio: 1; }
.pg-tile--modal { --z: 28px; }
.pg-tile--modal .pg-zones { font-size: 11px; }

.pgm-info { padding: 36px 36px 32px; }
.pgm-kicker,
.pgm-sub {
  font-family: var(--pg-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.pgm-kicker { color: var(--pg-accent); margin-bottom: 14px; }
.pgm-name {
  margin: 0 0 28px;
  font-size: clamp(28px, 3.2vw, 40px);
  color: #fff;
}
.pgm-specs { margin: 0; border-top: 1px solid var(--pg-line-mid); }
.pgm-specs > div {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--pg-line-mid);
}
.pgm-specs > div[hidden] { display: none; }
.pgm-specs dt {
  font-family: var(--pg-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pg-label);
}
.pgm-specs dd { margin: 0; font-size: 14px; color: #fff; }
.pgm-sub { color: var(--pg-label); margin: 32px 0 12px; }
.pgm-story p { margin: 0 0 14px; font-size: 15px; line-height: 1.7; color: rgba(255, 255, 255, 0.8); }
.pgm-story p.pgm-pending { color: var(--pg-label); }
.pgm-links { display: flex; flex-wrap: wrap; gap: 12px 20px; margin-top: 22px; font-size: 14px; }
.pgm-links a { color: #a8cdff; text-underline-offset: 4px; }
.pgm-links a:focus-visible { outline: 2px solid var(--pg-accent); outline-offset: 4px; }

.pgm-media { padding: 4px 36px 36px; }
.pgm-media .pgm-sub { margin-top: 24px; }
.pgm-video {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--pg-line-mid);
}
.pgm-video iframe,
.pgm-video video {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}
.pgm-video.is-empty { background: var(--pg-bg); }
.pgm-soon {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  background-image:
    linear-gradient(90deg, var(--pg-line) 1px, transparent 1px),
    linear-gradient(var(--pg-line) 1px, transparent 1px);
  background-size: 12.5% 22.2%;
}
.pgm-soon i {
  position: relative;
  width: 56px;
  height: 56px;
  margin-bottom: 8px;
  border: 1px solid var(--pg-line-strong);
  border-radius: 50%;
}
.pgm-soon i::after {
  content: '';
  position: absolute;
  left: 22px;
  top: 18px;
  border-left: 16px solid var(--pg-ink);
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
}
.pgm-soon b {
  font-family: var(--pg-mono);
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #fff;
}
.pgm-soon span { font-size: 13px; color: var(--pg-label); }

@media (max-width: 820px) {
  .pgm {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
  }
  .pgm-body { grid-template-columns: 1fr; }
  .pgm-drawing { border-right: 0; border-bottom: 1px solid var(--pg-line-mid); }
  .pg-tile--modal { --z: 20px; }
  .pg-tile--modal .pg-zones { font-size: 9px; }
  .pgm-info { padding: 26px 20px 8px; }
  .pgm-specs > div { grid-template-columns: 120px 1fr; }
  .pgm-media { padding: 4px 20px 28px; }
}

@media (min-width: 821px) and (max-width: 1280px) {
  #parts-gallery .section-inner { padding-inline: 56px; }
}

@media (max-width: 820px) {
  #parts-gallery { padding: 80px 0 72px; }
  #parts-gallery .section-inner { padding: 0 20px; }
  .pg-head { margin-bottom: 36px; }
  .pg-deck { font-size: 14px; }
  .pg-tile { --z: 16px; }
  .pg-tile--big { --z: 20px; }
  .pg-stage { inset: 18% 15% 22% 10%; }
  .pg-tile--big .pg-stage { inset: 13% 13% 18% 9%; }
  .pg-tile--wide .pg-stage { inset: 20% 14% 26% 8%; }
  .pg-corner { font-size: 7px; }
  .pg-zones { font-size: 8px; }
  .pg-tile--big .pg-zones { font-size: 9px; }
  .pg-mark { width: 14px; height: 14px; right: 8px; }
  .pg-mark--tr { top: 8px; }
  .pg-mark--br { bottom: 8px; }
  .pg-title { left: 6px; bottom: 6px; font-size: 8px; max-width: calc(100% - 34px); }
  .pg-title > span { padding: 4px 5px; }
  .pg-tile--big .pg-title { font-size: 9px; }
  .pg-dim b { font-size: 8px; padding: 0 3px; }
  .pg-foot { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .pgm[open] { animation: none; }
  .pg-tile *,
  .pg-tile *::before,
  .pg-tile *::after { transition: none !important; }
  .pg-tile:is(:hover, :focus-within, .is-active) .pg-fig img { transform: none; }
}
