/* /work, the portfolio. Builds on tokens.css and name.css. A hollow "Work"
   (space mode, js/work.js: a telescope sweeping a path across the night sky,
   each project's screenshot sharpening as it comes to the centre), then the
   projects: a
   large screenshot beside its title, description, tags and link,
   alternating sides on wide screens. */

.work .site-header { position: absolute; top: 0; left: 0; right: 0; z-index: 3; }

/* Positioned; the telescope covers it while it is up. */
.work-hero {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  display: flex;
  align-items: center;
}
.work-hero .title-layer {
  position: relative;
  width: 100%;
  padding: 104px var(--gutter) 72px;
  transition: opacity 0.6s var(--ease);
}
/* While the telescope is up, the title steps back and the page holds still
   (the wheel and swipes sweep the sky instead). */
.work-hero.is-on .title-layer { opacity: 0; pointer-events: none; }
html.scope-on,
html.scope-on body { overflow: hidden; overscroll-behavior: none; }
html.scope-on .work-hero { touch-action: none; }
html.scope-on main > :not(.work-hero),
html.scope-on .site-footer { visibility: hidden; }
.work .hero-name { font-size: clamp(4.25rem, 19vw, 15rem); cursor: pointer; }
.work .hero-name:hover .hero-name-outline { -webkit-text-stroke-color: var(--sage-hi); }
.work-hero.is-on .hero-name { cursor: default; }
.work-hero.is-on .hero-name:hover .hero-name-outline { -webkit-text-stroke-color: var(--sage); }

/* Keyboard users get a visible button when they tab to it (space works
   too); everyone else clicks the word. */
.launch-link {
  position: absolute;
  right: var(--gutter);
  top: 88px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}
.launch-link:focus-visible { opacity: 1; transform: none; pointer-events: auto; }

/* ---------- the telescope ---------- */

/* The sky (a WebGL canvas, and the screenshots in a panned layer), under a
   round eyepiece: dark outside the circle, a soft edge, the reticle. The
   eyepiece radius --scope-r is set by js/work.js. */
.scope {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  opacity: 0;
  animation: scope-in 1s var(--ease) forwards;
}
.scope[hidden] { display: none; }
.work-hero:not(.is-on) .scope { animation: scope-out 0.6s var(--ease) forwards; }
@keyframes scope-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes scope-out { from { opacity: 1; } to { opacity: 0; } }
.scope-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.scope-sky { position: absolute; left: 0; top: 0; }
.scope-obj {
  position: absolute;
  left: 0;
  top: 0;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 3px;
  transform: translate(-50%, -50%);
}
.scope-obj img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.scope-obj.is-blank {
  display: grid;
  place-items: center;
  padding: 16px;
  background: radial-gradient(circle at 40% 40%, #2c4150, #0c151c 70%);
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}
.scope-eyepiece {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%,
    transparent 0 calc(var(--scope-r) - 24px),
    rgba(2, 4, 3, 0.75) calc(var(--scope-r) - 3px),
    #020403 calc(var(--scope-r) + 1px));
}
.scope-reticle { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); overflow: visible; }
.scope-coords {
  position: absolute;
  left: calc(50% + var(--scope-r) * 0.35);
  top: calc(50% - var(--scope-r) - 30px);
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  white-space: nowrap;
}
.scope-readout {
  position: absolute;
  left: 50%;
  top: calc(50% + var(--scope-r) + 14px);
  transform: translateX(-50%);
  width: min(90vw, 36rem);
  text-align: center;
  pointer-events: none;
}
.scope-meta {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sage);
}
.scope-title { margin-top: 6px; font-size: 1.125rem; color: var(--text); }
.scope.is-locked .scope-title { color: var(--sage-hi); font-weight: 600; }
.scope-link {
  position: absolute;
  left: 50%;
  top: calc(50% + var(--scope-r) - 58px);
  transform: translateX(-50%);
  padding: 8px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(2, 4, 3, 0.8);
  color: var(--sage-hi);
  font-size: 0.8125rem;
  white-space: nowrap;
  animation: scope-in 0.4s var(--ease);
}
.scope-link[hidden] { display: none; }
.scope-link:hover { border-color: var(--sage-hi); }
.scope-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}

.work-intro {
  margin-top: clamp(14px, 2vw, 24px);
  max-width: 32rem;
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.125rem);
}

.work-list {
  list-style: none;
  margin: 0;
  padding: 0 var(--gutter);
  display: grid;
  gap: clamp(56px, 9vw, 120px);
}
.work-item {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
  padding-top: clamp(24px, 3vw, 40px);
  border-top: 1px solid var(--line);
}
.work-item:nth-child(even) .work-shot { order: 2; }

.work-shot {
  margin: 0;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
}
.work-shot a { display: block; height: 100%; }
.work-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform 0.6s var(--ease);
}
.work-shot a:hover img { transform: scale(1.02); }
.work-shot-empty {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 24px;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

.work-text h2 {
  margin-top: 10px;
  font-size: clamp(1.75rem, 3.4vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--sage);
}
.work-desc { margin-top: 14px; color: var(--text); max-width: var(--measure); }
.work-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
}
.work-tags li {
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8125rem;
}
.work-link { display: inline-block; margin-top: 22px; }

.work-empty { padding: 0 var(--gutter); color: var(--muted); }

@media (max-width: 760px) {
  .work-item { grid-template-columns: 1fr; }
  .work-item:nth-child(even) .work-shot { order: 0; }
}
