/*
 * Real photographs of space (owner, 2026-11-01: "real photos/cut-outs and animations and better aesthetic variance in
 * colors and shapes"). Loaded on every page. app/Http/Art/Space.php and assets/js/space.js write the markup.
 *
 *   .world        the phase glyph as a photograph: a planet or moon, its lit part = mastery (light from the right), a solid
 *                 ring when unlocked, a dashed ring when almost, grey and dim when locked, a small real Moon when a review is
 *                 due (red-lit when overdue); [data-dom] adds a rim of the subject's hue on the lit limb.
 *   .photo-band   a window onto a photograph (a subject's sky, Earthrise...), always night, with a scrim for its text; it
 *                 drifts very slowly.
 *   .cutout       a free cut-out (the astronaut, Saturn) that floats.
 *   .rise-in      children rise in once, one after another (--i).
 * Every movement here stops under reduced motion.
 */

/* ------------------------------------------------------------------ world */
.world { position: relative; display: inline-block; flex: none; width: var(--w, 48px); height: var(--w, 48px); vertical-align: middle; }
.world__disc { position: absolute; inset: 0; overflow: hidden; border-radius: 50%; background: var(--world-night); box-shadow: var(--world-shadow); }
.world__photo { display: block; width: 100%; height: 100%; max-width: none; transform: rotate(var(--turn, 0deg)); transition: transform .5s var(--ease), filter .3s var(--ease); }
/* Limb darkening: the edge of a sphere is darker; the light comes from the upper right. */
.world__disc::after { content: ""; position: absolute; inset: 0; z-index: 2; border-radius: 50%; pointer-events: none; background: radial-gradient(circle at 64% 38%, transparent 46%, var(--world-limb) 100%); }
/* The subject's rim light on the lit limb. */
.world[data-dom] .world__disc::before { content: ""; position: absolute; inset: 0; z-index: 3; border-radius: 50%; pointer-events: none; mix-blend-mode: screen;
  box-shadow: inset calc(var(--w) * -.06) 0 calc(var(--w) * .1) calc(var(--w) * -.04) color-mix(in srgb, var(--tint) 80%, transparent); }
/* The night side: the same terminator as the phase glyph, softened. */
.world__night { position: absolute; inset: -3%; max-width: none; z-index: 1; width: 106%; height: 106%; fill: var(--world-night); filter: blur(calc(var(--w) * .022)); }
/* Mastery (the 3D reading): every world stays lit; colour and halo grow with --m (0..1), and a started world wears the arc. */
.world:not(.world--phase) .world__photo { filter: saturate(calc(.6 + .5 * var(--m, 0))) brightness(calc(.84 + .2 * var(--m, 0))); }
.world:not(.world--phase) .world__disc { box-shadow: var(--world-shadow), 0 0 calc(var(--w) * .42 * var(--m, 0)) calc(var(--w) * -.08) color-mix(in srgb, var(--tint, var(--bone)) 60%, transparent); }
/* A phase world (a Moon) shows the photograph at full strength on its lit side. */
.world--phase .world__photo { filter: brightness(1.18) contrast(1.06); }
.world__arc { position: absolute; inset: calc(var(--w) * -.1); max-width: none; z-index: 1; width: calc(100% + var(--w) * .2); height: calc(100% + var(--w) * .2); overflow: visible; fill: none; pointer-events: none; }
.world__arc-track { stroke: color-mix(in srgb, var(--text) 14%, transparent); stroke-width: .05; }
.world__arc-fill { stroke: var(--tint, var(--bone)); stroke-width: .075; stroke-linecap: round; filter: drop-shadow(0 0 3px color-mix(in srgb, var(--tint, var(--bone)) 75%, transparent)); }
.world__ring { position: absolute; inset: calc(var(--w) * -.17); max-width: none; width: calc(100% + var(--w) * .34); height: calc(100% + var(--w) * .34); overflow: visible; fill: none; stroke: var(--st-unlocked); stroke-width: .045; opacity: .85; pointer-events: none; }
.world__ring--dashed circle { stroke-dasharray: .55 .45; opacity: .9; }
.world__moon { position: absolute; top: calc(var(--w) * -.12); right: calc(var(--w) * -.14); width: max(13px, calc(var(--w) * .32)); height: max(13px, calc(var(--w) * .32)); border-radius: 50%; box-shadow: 0 0 6px -1px var(--bone), var(--world-shadow); }
.world__moon.is-overdue { filter: sepia(1) saturate(5) hue-rotate(-38deg) brightness(.95); box-shadow: 0 0 8px var(--st-overdue); }
.world--locked .world__disc { filter: grayscale(.6) brightness(.6) contrast(.95); }
.world--locked { opacity: .9; }
/* A lit world under the pointer turns a little, as if it rotated toward you. */
a:hover .world__photo, a:focus-visible .world__photo { transform: rotate(calc(var(--turn, 0deg) + 14deg)) scale(1.04); }

/* The next stop: a cyan beacon that breathes outward (where you act next). */
.world--next::before { content: ""; position: absolute; inset: calc(var(--w) * -.08); border-radius: 50%; pointer-events: none; box-shadow: 0 0 0 2px var(--cyan), 0 0 18px 2px var(--halo-strong); }
.world--float { animation: world-float 7s ease-in-out infinite; animation-delay: calc(var(--i, 0) * -1.1s); }
@keyframes world-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -4px; } }
@media (prefers-reduced-motion: no-preference) {
  .world--next::after { content: ""; position: absolute; inset: calc(var(--w) * -.08); border-radius: 50%; pointer-events: none; box-shadow: 0 0 0 2px var(--cyan); animation: world-beacon 2.4s var(--ease) infinite; }
}
@media (prefers-reduced-motion: no-preference) { .world--grow .world__arc-fill { animation: world-arc-grow 1.4s var(--ease) both; } }
@keyframes world-arc-grow { from { stroke-dasharray: 0 100; } }
@keyframes world-beacon { 0% { opacity: .9; scale: 1; } 100% { opacity: 0; scale: 1.55; } }

/* A world whose mastery changes in front of you (the review moon) eases its terminator. */
.world__night path { transition: d .9s var(--ease); }

/* ------------------------------------------------------------------ photo band */
.photo-band { position: relative; isolation: isolate; overflow: hidden; border-radius: var(--r-lg); background: var(--bg); color: var(--text); }
.photo-band__img { position: absolute; inset: -3%; z-index: -2; width: 106%; height: 106%; max-width: none; object-fit: cover; object-position: var(--focus, 50% 50%); }
/* The scrim: dark where the text sits (the start side and the foot), the photograph clear elsewhere. */
.photo-band::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(90deg, var(--photo-scrim-strong) 0%, var(--photo-scrim) 46%, var(--photo-veil) 100%), linear-gradient(0deg, var(--photo-scrim-strong) 0%, transparent 42%); }
.photo-band--center::before { background: radial-gradient(70% 90% at 50% 55%, var(--photo-scrim-strong), var(--photo-scrim) 60%, var(--photo-veil)); }
/* The subject's hue washes faintly over its sky. */
.photo-band[data-dom]::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; mix-blend-mode: color; background: color-mix(in srgb, var(--tint) 22%, transparent); }
@media (prefers-reduced-motion: no-preference) {
  .photo-band__img { animation: band-drift 48s ease-in-out infinite alternate; }
}
@keyframes band-drift { from { transform: scale(1) translate(0, 0); } to { transform: scale(1.07) translate(-1.5%, -1%); } }

/* ------------------------------------------------------------------ cut-outs */
.cutout { position: absolute; z-index: 0; max-width: none; height: auto; pointer-events: none; user-select: none; filter: drop-shadow(0 18px 30px var(--photo-scrim-strong)); }
@media (prefers-reduced-motion: no-preference) {
  .cutout { animation: cutout-drift 14s ease-in-out infinite alternate; }
  .cutout--slow { animation-duration: 22s; }
}
@keyframes cutout-drift { 0% { transform: translate(0, 0) rotate(0deg); } 50% { transform: translate(-6px, -10px) rotate(-2deg); } 100% { transform: translate(4px, -4px) rotate(1.5deg); } }

/* ------------------------------------------------------------------ shapes */
/* A chamfered panel (a spacecraft plate): two corners cut, for cards that need a shape other than a rounded box. */
.chamfer { --cut: 14px; border-radius: 0; clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut))); }

/* ------------------------------------------------------------------ entrance */
@media (prefers-reduced-motion: no-preference) {
  .rise-in > * { animation: rise-in .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
}
@keyframes rise-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .world__photo, .world__night path { transition: none; }
  .world--float { animation: none; }
}
