/* Titan's Domain (master 8, pass one). Everything that moves is transform or opacity on its own layer; nothing here triggers layout while the orbit runs.
   js/titan.js sets --tw and --th (Titan's width and height in px) on <html>; the crown and his speech are placed from them. */
html, body.titan-page { height: 100%; overflow: hidden; overscroll-behavior: none; background: #000; }
/* nothing on Titan's page can be selected or highlighted, and nothing can be dragged out as an image (Sam, 2026-10-28) */
html, body.titan-page, body.titan-page *, #veil, .vcard { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
body.titan-page img { -webkit-user-drag: none; user-drag: none; }
body.titan-page ::selection { background: transparent; }

/* DEPTH is worked out in js/titan.js, not by the browser's 3D (which left every photo one size in Safari): each photo gets its place, its size, its lean, its
   opacity and its place in the stack (z-index) from the script. Titan stands at 500 in that stack: photos on the far half of an orbit are under him (100+), photos on
   the near half are over him (600+). The far ones are also softened, in two steps (--soft1 / --soft2 are set by the script from the photo size). */
#stage { position: fixed; inset: 0; overflow: hidden; touch-action: none; }
#orbit { position: absolute; inset: 0; pointer-events: none; }
/* Only the photos and Titan himself take pointer events. */
.orb { pointer-events: auto; }
.orb.soft1 { filter: blur(var(--soft1, 1.6px)); }
.orb.soft2 { filter: blur(var(--soft2, 3.6px)); }
#rings { position: absolute; left: 0; top: 0; pointer-events: none; }

/* ---------- THE FRAMES (Sam, 2026-11-10: "skip them. Make simple clean ones yourself, using the underscratch as the style reference") ----------
   One drawn rectangle for every photo: four strokes that run a little past the corners, each a firm line with a thinner dry one beside it, in the ink colour, like
   the underscratch stroke. It is an SVG stretched over the photo's box plus 6% a side; the strokes keep their thickness at any size (non-scaling), so a 40px photo on a
   phone and the big viewer both get a clean line. It rides on the photo's own layer, so it costs nothing per frame. --frame is the small one, --frame-big the viewer's. */
:root {
  --frame: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none' fill='none' stroke='%23f5f3ee' stroke-linecap='round'%3E%3Cg stroke-width='3.3' vector-effect='non-scaling-stroke'%3E%3Cpath vector-effect='non-scaling-stroke' d='M1.5 5C25 3.6 60 6 98.6 4.3'/%3E%3Cpath vector-effect='non-scaling-stroke' d='M95.6 1.4C96.8 30 94.7 65 96 98.6'/%3E%3Cpath vector-effect='non-scaling-stroke' d='M98.4 95.5C70 96.8 35 94.5 1.2 96'/%3E%3Cpath vector-effect='non-scaling-stroke' d='M4.4 98.8C3.2 70 5.5 35 4 1.2'/%3E%3C/g%3E%3Cg stroke-width='1.6' opacity='.55'%3E%3Cpath vector-effect='non-scaling-stroke' d='M5 7.2C30 6.2 70 8 95 6.6'/%3E%3Cpath vector-effect='non-scaling-stroke' d='M93.4 5C94.3 35 92.8 70 93.7 95'/%3E%3Cpath vector-effect='non-scaling-stroke' d='M95 93.3C65 94.2 30 92.5 5.5 93.6'/%3E%3Cpath vector-effect='non-scaling-stroke' d='M6.6 95C5.8 65 7.3 30 6.4 5'/%3E%3C/g%3E%3C/svg%3E");
  --frame-big: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none' fill='none' stroke='%23f5f3ee' stroke-linecap='round'%3E%3Cg stroke-width='3.4'%3E%3Cpath vector-effect='non-scaling-stroke' d='M1.5 5C25 3.6 60 6 98.6 4.3'/%3E%3Cpath vector-effect='non-scaling-stroke' d='M95.6 1.4C96.8 30 94.7 65 96 98.6'/%3E%3Cpath vector-effect='non-scaling-stroke' d='M98.4 95.5C70 96.8 35 94.5 1.2 96'/%3E%3Cpath vector-effect='non-scaling-stroke' d='M4.4 98.8C3.2 70 5.5 35 4 1.2'/%3E%3C/g%3E%3Cg stroke-width='1.5' opacity='.55'%3E%3Cpath vector-effect='non-scaling-stroke' d='M5 7.2C30 6.2 70 8 95 6.6'/%3E%3Cpath vector-effect='non-scaling-stroke' d='M93.4 5C94.3 35 92.8 70 93.7 95'/%3E%3Cpath vector-effect='non-scaling-stroke' d='M95 93.3C65 94.2 30 92.5 5.5 93.6'/%3E%3Cpath vector-effect='non-scaling-stroke' d='M6.6 95C5.8 65 7.3 30 6.4 5'/%3E%3C/g%3E%3C/svg%3E");
}
#stage.framed .orb::after { content: ""; position: absolute; inset: -6%; background: var(--frame) center / 100% 100% no-repeat; pointer-events: none; }

/* Titan: fixed at the centre, and he is a button (each click is his next phrase). The small silly movements are on the picture inside, so his place never changes. */
#titan { position: absolute; left: 50%; top: 50%; z-index: 500; transform: translate3d(-50%, -50%, 0); pointer-events: auto; cursor: pointer; outline-offset: 6px; }
#titan picture { display: block; transform-origin: 50% 85%; }
#titan img { display: block; width: 100%; height: auto; pointer-events: none; }
#titan picture.w0 { animation: t-hop .5s ease-out; }
#titan picture.w1 { animation: t-tilt .55s ease-in-out; }
#titan picture.w2 { animation: t-squash .5s ease-out; }
#titan picture.w3 { animation: t-shake .5s ease-in-out; }
@keyframes t-hop { 35% { transform: translateY(-9%); } 70% { transform: translateY(1.5%); } }
@keyframes t-tilt { 30% { transform: rotate(-7deg); } 70% { transform: rotate(5deg); } }
@keyframes t-squash { 30% { transform: scale(1.08, .9); } 65% { transform: scale(.95, 1.06); } }
@keyframes t-shake { 20% { transform: translateX(-4%); } 45% { transform: translateX(4%); } 70% { transform: translateX(-2%); } }

/* the crown is drawn in front of everything on the page (master 8.2), and it is never a target */
#crown { position: fixed; z-index: 25; left: 50%; top: calc(50% - var(--th, 120px) / 2); width: calc(var(--tw, 100px) * .45); transform: translate(-50%, -70%); pointer-events: none; }
#crown img { display: block; width: 100%; height: auto; }
html:not([data-motion="reduced"]):not([data-pause="1"]) #crown picture { display: block; animation: crown-float 4s ease-in-out infinite; }
@keyframes crown-float { 50% { transform: translateY(-.4rem); } }

/* what Titan says: a small scratch box up and to the right of him. It shows, holds, and fades into the Void. */
#say { position: fixed; z-index: 24; left: calc(50% + var(--tw, 100px) * .44); bottom: calc(50% + var(--th, 120px) * .34);
  width: max-content; max-width: min(15rem, calc(50vw - var(--tw, 100px) * .44 - .75rem)); padding: .5rem .8rem; background: #000; border: 2px solid var(--line); border-radius: 3px 8px 4px 7px;
  font-size: 1.05rem; line-height: 1.35; opacity: 0; pointer-events: none; transition: opacity .7s ease; }
#say.on { opacity: 1; transition-duration: .2s; }
#say .big { font-size: 1.3em; letter-spacing: .05em; }
#say.jih { padding: .45rem .6rem; }
#say picture { display: block; }
#say img { display: block; width: min(11rem, 100%); height: auto; filter: invert(1); }                  /* Jihbert is drawn in black ink: shown white, as in the Void */

.orb { position: absolute; left: 50%; top: 50%; opacity: .6; cursor: grab; touch-action: none; will-change: transform, opacity; }
.orb picture, .orb img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.orb.up { opacity: .98; }
/* photos are solid, so a touch shows as a stronger glow */
#stage:not(.no-glow) .orb.up { box-shadow: 0 0 44px 8px rgba(245, 243, 238, .6); }
.orb.grab { cursor: grabbing; }
/* the faint glow: a plain shadow, rasterized once with the layer (the element is laid out large and scaled down, so the shadow is drawn large too) */
#stage:not(.no-glow) .orb { box-shadow: 0 0 26px 2px rgba(245, 243, 238, .28); }
#stage.solid .orb { opacity: 1; }
.orb:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* the viewer: the background goes dark, the photo floats to the middle and grows (transform and opacity only) */
#veil { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .8); opacity: 0; pointer-events: none; transition: opacity .4s ease; }
#veil.on { opacity: 1; pointer-events: auto; }
.vcard { position: fixed; z-index: 31; box-sizing: border-box; transform-origin: 50% 50%; will-change: transform; touch-action: none; outline: none; box-shadow: 0 0 40px 6px rgba(245, 243, 238, .18); }
.vcard::after { content: ""; position: absolute; inset: -6%; background: var(--frame-big) center / 100% 100% no-repeat; pointer-events: none; }
.vcard img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }

.titan-page .return-bar { z-index: 40; }
