/* Memories (master 6) and the piece page (6.1). Monochrome: the art is the only colour.
   FRAMES: a frame's canvas is its artwork's canvas + 20% with the artwork centred (Sam, 2026-10-29), so the frame image is laid over the artwork's box at -10% on every
   side (120% wide and tall) and may spill outside it. Nothing around an artwork may clip that spill: overflow:auto rails get padding for it, and every gap below is
   at least the spill (10% of the artwork's own width / height) plus air. */

body.inner { position: relative; }
.world { position: relative; z-index: 1; }

.page-title { margin: 0; padding: calc(var(--space) * 1.5) var(--space) 0; text-align: center; font-weight: normal; font-size: clamp(2.4rem, 8vw, 4.5rem); line-height: 1.1; }
.page-sub { margin: .25rem 0 0; padding: 0 var(--space); text-align: center; color: var(--ink-dim); }

/* the artwork: a box with the artwork's own proportions; the frame is its overlay */
/* display:block is REQUIRED: on the Memories page .art is a <span>. Left inline, Safari (every iPhone browser) sizes the frame against an empty inline box, so the
   frame loads but is laid out 0 x 0 and every piece sits bare; Chrome and Firefox happen to measure the picture inside it instead (found 2026-11-11 in WebKit). */
.art { display: block; position: relative; width: var(--aw); aspect-ratio: var(--ar); }
.art picture { display: block; width: 100%; height: 100%; }
.art picture img { display: block; width: 100%; height: 100%; max-width: none; }
.frame { position: absolute; left: -10%; top: -10%; width: 120%; height: 120%; max-width: none; pointer-events: none; z-index: 1; }

/* ---------- the episodes ---------- */
#episodes { padding-block: calc(var(--space) * 1.5) calc(var(--space) * 3); }
.episode { margin: 0 0 clamp(10rem, 34vw, 13rem); }                                              /* dark between the episodes: room for the Void's drawings (Sam, 2026-11-10), and each episode reads as its own idea */
.episode > h2 { margin: 0; padding: 0 var(--space); text-align: center; font-weight: normal; font-size: clamp(1.9rem, 6vw, 3rem); line-height: 1.15; letter-spacing: .02em; }   /* names exactly as written: no text-transform */
.episode .soon { color: var(--ink-dim); }
.scramble { display: inline-block; min-width: 6ch; }

.rail-wrap { position: relative; --u: min(66vw, 22rem); }
.rail { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; overscroll-behavior-x: contain; outline-offset: -2px;
  padding: calc(var(--u) * .115 + .6rem) var(--space) .5rem; }                                  /* room for the frames' spill above (and below) the pieces */
.rail::-webkit-scrollbar { display: none; }
.rail.dragging { cursor: grabbing; user-select: none; -webkit-user-select: none; }
.rail-list { list-style: none; margin: 0; padding: 0; display: flex; align-items: flex-start; width: max-content; margin-inline: auto; }
.piece { flex: none; --aw: calc(var(--u) * var(--ar)); --ah: calc(var(--aw) / var(--ar));
  margin-inline: calc(var(--aw) * .1 + .9rem); }                                               /* side by side the spills (10% each) never touch */
.piece.land { --aw: calc(var(--u) * 1.15); }
.piece-link { display: block; width: var(--aw); -webkit-tap-highlight-color: transparent; -webkit-user-drag: none; }
.piece-link:hover, .piece-link:focus-visible { background: none; }
.piece-link:focus-visible { outline: none; }
.piece-link:focus-visible .art, .piece-link:hover .art { filter: drop-shadow(0 0 10px rgba(245, 243, 238, .35)); }
.piece .cap { display: block; margin-top: calc(var(--ah) * .1 + .55rem); text-align: center; font-size: 1.2rem; line-height: 1.2; overflow-wrap: anywhere; }

/* the rail arrows are Sam's drawn arrows with nothing around them; a dark halo keeps the line readable over a piece */
.rail-btn { position: absolute; top: 45%; transform: translateY(-50%); z-index: 3; width: clamp(5rem, 10vw, 6.75rem); min-height: var(--touch); padding: .4rem; background: none; border: 0; cursor: pointer;
  font: 2rem/1 var(--font-scratch); color: var(--ink); filter: drop-shadow(0 0 3px #000) drop-shadow(0 0 8px rgba(0, 0, 0, .9)); transition: transform .34s cubic-bezier(.3, 2.3, .5, 1), filter .25s ease, opacity .2s linear; }
.rail-btn picture, .rail-btn img { display: block; width: 100%; height: auto; max-width: none; pointer-events: none; }
.rail-btn.prev { left: .5rem; } .rail-btn.next { right: .5rem; }
.rail-btn:hover, .rail-btn:focus-visible { background: none; filter: drop-shadow(0 0 3px #000) drop-shadow(0 0 8px rgba(0, 0, 0, .9)) drop-shadow(0 0 6px rgba(245, 243, 238, .8)); }
.rail-btn:active { transform: translateY(calc(-50% + 3px)); transition: transform .07s ease-out, filter .25s ease; }
.rail-btn[hidden] { display: none; }
@media (hover: none), (pointer: coarse) { .rail-btn { pointer-events: none; } }                 /* phones swipe: the arrows only show there is more, and never block a tap on a piece */

.mem-empty { text-align: center; color: var(--ink-dim); padding: 2rem var(--space); }

/* ---------- the piece page ---------- */
.piece-page { padding: calc(var(--space) * 1.2) var(--space) calc(var(--space) * 3); display: flex; flex-direction: column; align-items: center; }
.p-fig { margin: 0 0 calc(var(--space) * 1.5); }
.p-fig { --avail: min(100vw - 2 * var(--space), 60rem); --aw: min(var(--avail) / 1.2, 76svh * var(--ar) / 1.2); }
.p-fig .art { margin: calc(var(--aw) / var(--ar) * .1) calc(var(--aw) * .1); }                  /* the spill's room, as margin */
.p-fig figcaption { text-align: center; color: var(--ink-dim); margin-top: calc(var(--aw) / var(--ar) * .1 + .25rem); }
.p-title { margin: .5rem 0 .25rem; text-align: center; font-weight: normal; font-size: clamp(2rem, 6.5vw, 3.4rem); line-height: 1.15; overflow-wrap: anywhere; }
.p-meta { list-style: none; margin: 0 0 1rem; padding: 0; text-align: center; color: var(--ink-dim); }
.p-desc { max-width: 34rem; margin: 0 0 1.5rem; text-align: center; font-size: 1.1rem; }
.piece-page .go { text-decoration: none; }

html[data-contrast="high"] .rail-btn { border-width: 3px; }
