/* Jobs: the ruled index, with a blurred preview box beside it. */

.jobs {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 90px 40px;
  font-family: var(--mono);
}
/* faint dot field behind everything, fading toward the edges */
.jobs::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--fg-dim) 1px, transparent 1.4px);
  background-size: 28px 28px;
  opacity: 0.22;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 0%, transparent 68%);
  mask-image: radial-gradient(ellipse at center, #000 0%, transparent 68%);
  pointer-events: none;
}

.deck {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, min(750px, 42%));
  grid-template-areas:
    "head head"
    "list preview";
  column-gap: 120px;
  width: 100%;   /* edges line up with the nav's 40px margins */
  background: var(--bg);
  box-shadow: 0 0 0 18px var(--bg);   /* clears the dot field behind the content */
}

.panel-head {
  grid-area: head;
  padding-bottom: clamp(34px, 6.5vh, 64px);
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.jobs-list { grid-area: list; list-style: none; }
.jobs-list li + li { border-top: 1px solid var(--rule); }

.job {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto 22px;
  align-items: center;
  gap: 12px;
  padding: 18px 10px 18px 12px;
  color: var(--fg);
  text-decoration: none;
  transition: opacity 0.3s ease, background-color 0.3s ease, padding 0.3s ease;
}
/* selection bar on the left edge */
.job::before {
  content: '';
  position: absolute;
  left: 0;
  top: -1px;
  bottom: -1px;
  width: 2px;
  background: var(--fg);
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.job-n {
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--fg-dim);
}
.job-name {
  font-family: 'Chakra Petch', var(--mono);
  font-size: clamp(14px, 2.2vw, 22px);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1;
}
.job-note {
  font-size: 9px;
  letter-spacing: 0.22em;
  line-height: 13px;
  text-transform: uppercase;
  color: var(--fg-dim);
  text-align: right;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.job-note span { display: block; }
.job-go {
  justify-self: end;
  font-size: 13px;
  color: var(--fg-dim);
  transition: transform 0.3s ease, color 0.3s ease;
}

@media (hover: hover) {
  .jobs-list:hover .job { opacity: 0.32; }
  .jobs-list .job:hover,
  .jobs-list .job:focus-visible { opacity: 1; background-color: var(--rule); }
  .job:hover::before,
  .job:focus-visible::before { transform: scaleY(1); }
  .job:hover .job-note,
  .job:focus-visible .job-note { opacity: 1; transform: none; }
  .job:hover .job-go,
  .job:focus-visible .job-go { color: var(--fg); transform: translate(2px, -2px); }
}
@media (hover: none) {
  .job-note { opacity: 0.75; transform: none; }
}

/* Dark theme: dark box that lights up. Light theme: the opposite, a white box that washes out to bright, faded images. */
:root {
  --pv-bg: #f4f4f4;
  --pv-cross: rgba(0, 0, 0, 0.5);
  --pv-filter: blur(46px) saturate(1.15) contrast(1) brightness(1.12);
  --pv-op: 0.85;
}
@media (prefers-color-scheme: dark) {
  :root {
    --pv-bg: #0b0b0c;
    --pv-cross: rgba(255, 255, 255, 0.6);
    --pv-filter: blur(46px) saturate(1.25) contrast(1.05) brightness(0.62);
    --pv-op: 1;
  }
}

/* ---- preview box: spans the list from its top edge to its bottom edge. Dark with a crosshair until a row is pointed at. ---- */
.preview {
  grid-area: preview;
  position: relative;
  overflow: hidden;
  background: var(--pv-bg);
}
/* outline: drawn like a snake on load, same hairline as the list's rules */
.pv-frame { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; overflow: visible; }
.pv-frame rect {
  x: 0.5px; y: 0.5px;
  width: calc(100% - 1px); height: calc(100% - 1px);
  fill: none;
  stroke: var(--rule);
  stroke-width: 1px;
  stroke-dasharray: 100;
  stroke-dashoffset: 0;
  animation: pv-draw 1.1s cubic-bezier(0.4, 0, 0.2, 1) 0.1s backwards;
}
@keyframes pv-draw { from { stroke-dashoffset: 100; } }

/* counter just outside the box's lower right corner: 00 when nothing is selected, then 01 to 04 as you point at a row */
.pv-count {
  grid-area: preview;
  justify-self: end;
  align-self: end;
  transform: translateY(calc(100% + 14px));
  font-size: 9px;
  letter-spacing: 0.24em;
  color: var(--fg-dim);
  pointer-events: none;
}

/* crosshair, centred, stays on top of the image; grows out from the middle on load */
.preview::before,
.preview::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  background: var(--pv-cross);
}
.preview::before { width: 22px; height: 1px; margin: -0.5px 0 0 -11px; animation: pv-cross-x 0.55s cubic-bezier(0.4, 0, 0.2, 1) 0.9s backwards; }
.preview::after { width: 1px; height: 22px; margin: -11px 0 0 -0.5px; animation: pv-cross-y 0.55s cubic-bezier(0.4, 0, 0.2, 1) 1.05s backwards; }
@keyframes pv-cross-x { from { transform: scaleX(0); opacity: 0; } }
@keyframes pv-cross-y { from { transform: scaleY(0); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .pv-frame rect, .preview::before, .preview::after { animation: none; }
}

.pv-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: var(--ox, 50%) var(--oy, 50%);
  filter: var(--pv-filter);
  opacity: 0;
  transform: scale(2.4) rotate(-3deg);
  transition: opacity 0.7s ease;
}
.pv-img.on {
  opacity: var(--pv-op);
  animation: pv-drift 14s ease-in-out infinite alternate;
}
/* slow drift so the smear never sits still */
@keyframes pv-drift {
  from { transform: scale(2.4) rotate(-3deg) translate(0, 0); }
  to { transform: scale(2.7) rotate(2deg) translate(-2%, 1.5%); }
}
@media (prefers-reduced-motion: reduce) { .pv-img.on { animation: none; transform: scale(2.4); } }

@media (max-width: 860px) {
  .jobs { align-items: flex-start; padding: calc(env(safe-area-inset-top, 0px) + 90px) 16px 90px; }
  .deck {
    grid-template-columns: 1fr;
    grid-template-areas: "head" "list" "preview";
  }
  .job { grid-template-columns: 30px minmax(0, 1fr) 18px; row-gap: 8px; padding: 16px 6px 16px 10px; }
  .job-note { grid-column: 2; grid-row: 2; text-align: left; transform: none; }
  .job-go { grid-column: 3; grid-row: 1; }
  .job-name { letter-spacing: 0.1em; }
  .preview { height: 180px; margin-top: 28px; }
}
