/* The three.js page (/threejs/): Wireface for three.js (/assets/threejs/, built from ..\threejs by tools/threejs.mjs).
   The hero's stage shows the poster until the live scene is drawing, then fades it out. No inline styles: the page's
   script sets anything dynamic through the CSSOM. */

/* --- the hero's stage ----------------------------------------------------------------------------------------------- */
.tj-hero-side { display: grid; gap: 14px; justify-items: center; }
.tj-stage { position: relative; margin: 0; width: 100%; max-width: 560px; aspect-ratio: 1; border-radius: 22px; overflow: hidden;
  border: 1px solid var(--line); background: radial-gradient(70% 60% at 50% 42%, rgba(99, 102, 241, .16), transparent 70%), var(--night-2);
  box-shadow: 0 40px 90px -40px rgba(99, 102, 241, .55); touch-action: pan-y; }
.tj-stage canvas, .tj-stage .tj-poster { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.tj-poster { object-fit: cover; object-position: 58% 50%; transition: opacity .7s ease; }
.tj-stage canvas { opacity: 0; transition: opacity .7s ease; cursor: pointer; }
.tj-stage.live canvas { opacity: 1; }
.tj-stage.live .tj-poster { opacity: 0; }
.tj-who { position: absolute; left: 14px; top: 14px; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 6px 12px;
  border-radius: 999px; background: rgba(10, 18, 38, .8); border: 1px solid var(--line-2); font: 600 0.92rem var(--display);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.tj-badge { font: 500 0.66rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--cyan); padding: 4px 7px;
  border-radius: 999px; background: rgba(34, 211, 238, .12); }
.tj-badge:empty { display: none; }
.tj-caption { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 2; margin: 0;
  width: max-content; max-width: calc(100% - 28px); padding: 10px 14px; border-radius: 14px; background: rgba(10, 18, 38, .84);
  border: 1px solid var(--line-2); color: var(--text); font-size: 0.97rem; line-height: 1.45; transition: opacity .3s;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.tj-caption:empty { opacity: 0; }
.tj-stage .sound-row { top: 14px; right: 14px; }
.tj-stage .sound-hint { padding: 5px 10px; border-radius: 999px; background: rgba(10, 18, 38, .82); }
.tj-stage { container-type: inline-size; }
@container (max-width: 500px) { .tj-stage .sound-hint { display: none; } }   /* no room beside the name: the button says it */

.tj-pick { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 560px; }
.tj-pick button, .tj-pick a { border: 1px solid var(--line-2); background: rgba(13, 22, 48, .55); color: var(--muted); border-radius: 999px;
  padding: 6px 12px; font: 500 0.84rem var(--body); cursor: pointer; text-decoration: none; }
.tj-pick button:hover, .tj-pick a:hover { color: var(--text); border-color: rgba(34, 211, 238, .5); }
.tj-pick button[aria-pressed="true"] { color: var(--text); border-color: rgba(34, 211, 238, .8); background: rgba(34, 211, 238, .1); }
.tj-pick a { color: var(--cyan); border-style: dashed; }

/* --- what it does ------------------------------------------------------------------------------------------------- */
.tj-abilities .card { display: flex; flex-direction: column; min-width: 0; }   /* the code lines scroll, not the page */
.tj-abilities .card p { flex: 1; }
.tj-abilities .card code { display: block; margin-top: 14px; padding: 8px 10px; border-radius: 9px; background: #050916;
  border: 1px solid var(--line); font-size: 0.8rem; white-space: nowrap; overflow-x: auto; }

/* --- pictures ------------------------------------------------------------------------------------------------------- */
.tj-ways { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 2.2rem; }
.tj-shot { margin: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: rgba(13, 22, 48, .6); }
.tj-shot img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.tj-shot figcaption { padding: 18px 20px 20px; }
.tj-shot figcaption p { color: var(--muted); font-size: 0.95rem; }
.tj-shot.tj-wide { margin-top: 24px; }
.tj-shot.tj-wide img { aspect-ratio: 16 / 7; object-position: 50% 30%; }
.tj-cast-shot { margin: 2.2rem 0 0; border-radius: 18px; overflow: hidden; border: 1px solid var(--line);
  box-shadow: 0 40px 90px -50px rgba(99, 102, 241, .6); }
.tj-cast-shot img { display: block; width: 100%; height: auto; transition: transform .6s ease; }
.tj-cast-shot a:hover img { transform: scale(1.015); }
.tj-castlist { list-style: none; margin: 22px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px 22px; }
.tj-castlist li { color: var(--muted); font-size: 0.93rem; padding-left: 14px; border-left: 2px solid rgba(99, 102, 241, .45); }
.tj-castlist b { display: block; color: var(--text); font: 600 0.98rem var(--display); }

/* --- for developers --------------------------------------------------------------------------------------------------- */
.tj-dev { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; margin-top: 2.2rem; align-items: start; }
.tj-run { margin-top: 2.4rem; }
.tj-run-note { color: var(--muted); margin: 0 0 12px; }

@media (max-width: 860px) {
  .tj-dev, .tj-ways { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .tj-hero .wrap { grid-template-columns: minmax(0, 1fr); }
}

/* elements shown and hidden by the script (positioned or flex ones would otherwise ignore the hidden attribute) */
.tj-who[hidden], .tj-pick[hidden], .tj-stage .sound-row[hidden] { display: none; }
