/* A small re-drawing of the UJU app beside the text. Colours and sizes come from the app
   (lib/const/color.dart, size.dart): paper #F3F0E9, star #E5C33E at 18px with a 36px
   area, 72px orbit, grey planets at 9px, #777 lines, a black hole of 120px (160px while
   a star is held over it) centred on the top-right corner. The scene is laid out at
   640x420 and scaled to its box; scene.js moves it between states as the text is read.

   States, in reading order: overview → star → planet → constellation → blackhole → list.
   Each later state keeps what the earlier ones did (the new planet stays a planet). */
.uju { --ease:cubic-bezier(.3,.7,.2,1); position:relative; width:100%; aspect-ratio:640 / 420; border-radius:12px; overflow:hidden; background:#F3F0E9; color:#333; box-shadow:0 0 0 1px #3a3a3a, 0 30px 80px rgba(0,0,0,.5); font-family:'Helvetica Neue', Helvetica, Pretendard, sans-serif; }
.stage .media--scene { left:-40px; right:calc(24px - 48px - max(0px, (100vw - 1400px) / 2)); }
.uju-view { position:absolute; left:0; top:0; width:640px; height:420px; transform-origin:0 0; transform:scale(var(--k, 1)); }

/* The canvas the camera moves over. */
.uju-world { position:absolute; inset:0; transform-origin:0 0; transition:transform 900ms var(--ease); }
.uju[data-state="star"] .uju-world { transform:translate(-78px, -45px) scale(1.7); }
.uju[data-state="list"] .uju-world { transform:translate(165px, 40px) scale(.78); }
.uju-canvas { position:absolute; inset:0; width:640px; height:420px; overflow:visible; }
.uju-canvas line, .uju-canvas path, .uju-canvas text { transition:opacity 500ms ease-out; }

/* "산디과 수업": UX → 그래픽 → 컴퓨터 응용, and once UI 디자인 joins, a Z. The outline is
   the convex hull of its stars (as in the app), drawn by scene.js. */
.uju-link { stroke:#777; stroke-width:1; }
.uju-hull { fill:none; stroke:#6e6e6e; stroke-width:3; stroke-linejoin:round; }
.uju-hull-label { font-size:15px; fill:#333; text-anchor:middle; }
.uju-link--d, .uju-hull--2, .uju-guide { opacity:0; }
.uju:is([data-state="blackhole"], [data-state="list"]) :is(.uju-link--d, .uju-hull--2) { opacity:1; }
.uju:is([data-state="blackhole"], [data-state="list"]) .uju-hull--1 { opacity:0; }
.uju-guide { stroke:#ccc; stroke-width:2; stroke-dasharray:8 6; }
.uju[data-state="constellation"] .uju-guide { animation:uju-guide 2400ms linear forwards; }
.uju[data-state="constellation"] :is(.uju-link--d, .uju-hull--2) { animation:uju-show 2400ms linear forwards; }
.uju[data-state="constellation"] .uju-hull--1 { animation:uju-hide 2400ms linear forwards; }
@keyframes uju-guide { 0%, 45% { opacity:0; } 50%, 78% { opacity:1; } 82%, 100% { opacity:0; } }
@keyframes uju-show { 0%, 78% { opacity:0; } 90%, 100% { opacity:1; } }
@keyframes uju-hide { 0%, 78% { opacity:1; } 90%, 100% { opacity:0; } }

/* Stars: an 18px core, a 36px area while picked or held, a label under it. */
.uju-star { position:absolute; left:var(--x); top:var(--y); width:0; height:0; }
.uju-star b, .uju-star i, .uju-orbit { position:absolute; left:0; top:0; border-radius:50%; translate:-50% -50%; }
.uju-star b { width:18px; height:18px; background:#E5C33E; transition:width 400ms, height 400ms, background-color 400ms; }
.uju-star i { width:36px; height:36px; background:rgba(229,195,62,.2); border:1px solid #E5C33E; opacity:0; transition:opacity 300ms ease-out; }
.uju-star span { position:absolute; top:12px; left:0; translate:-50% 0; white-space:nowrap; font-size:12px; line-height:1.4; letter-spacing:.15px; transition:opacity 300ms; }
.uju[data-state="star"] .uju-star--a > i { opacity:1; }
.uju-orbit { width:72px; height:72px; background:rgba(229,195,62,.05); border:1px solid #E5C33E; }
.uju-star--a { --x:170px; --y:150px; }
.uju-star--c { --x:410px; --y:130px; }
.uju-star--b { --x:200px; --y:300px; }
.uju-star--d { --x:585px; --y:365px; }
.uju-star--e { --x:545px; --y:215px; }
.uju-star--f { --x:560px; --y:95px; }

/* Planets circle their star (20s a turn, as in the app); labels stay upright. */
.arm { position:absolute; left:0; top:0; }
.uju-orbiting .arm { animation:uju-orbit 20s linear infinite; }
.uju-orbiting .arm > * { animation:uju-unspin 20s linear infinite; }
.uju-orbiting b { width:9px; height:9px; background:#8E8E8E; }
.uju-orbiting span { top:7px; font-size:10px; color:#555; }
.uju-star--p { --x:170px; --y:150px; }
@keyframes uju-orbit { from { transform:rotate(0deg) translateX(36px); } to { transform:rotate(360deg) translateX(36px); } }
@keyframes uju-unspin { from { rotate:0deg; } to { rotate:-360deg; } }

/* planet: "UX 디자인 2강" is dragged onto the orbit of UX 디자인 and becomes its planet.
   Its old place stays faint while it is carried. scene.js adds .uju-orbiting on landing. */
.uju-ghost { position:absolute; left:545px; top:215px; width:18px; height:18px; border-radius:50%; background:#E5C33E; translate:-50% -50%; opacity:0; }
.uju[data-state="planet"] .uju-ghost { animation:uju-ghost 2400ms linear forwards; }
@keyframes uju-ghost { 0%, 15% { opacity:0; } 20%, 70% { opacity:.25; } 80%, 100% { opacity:0; } }
.uju[data-state="planet"] .uju-star--e:not(.uju-orbiting) { animation:uju-drag-e 1800ms var(--ease) forwards; }
@keyframes uju-drag-e { 0%, 24% { left:545px; top:215px; } 100% { left:var(--lx, 149px); top:var(--ly, 121px); } }
.uju[data-state="planet"] .uju-star--e:not(.uju-orbiting) i { opacity:1; }
.uju-star--e.uju-orbiting { --x:170px; --y:150px; }

/* constellation: "UI 디자인" is dragged next to 컴퓨터 응용 디자인 and joins the Z. */
.uju:is([data-state="constellation"], [data-state="blackhole"], [data-state="list"]) .uju-star--d { --x:450px; --y:300px; }
.uju[data-state="constellation"] .uju-star--d { animation:uju-drag-d 2400ms var(--ease) forwards; }
@keyframes uju-drag-d { 0%, 18% { left:585px; top:365px; } 72%, 100% { left:450px; top:300px; } }
.uju[data-state="constellation"] .uju-star--d > i { animation:uju-held 2400ms linear forwards; }
@keyframes uju-held { 0%, 15% { opacity:0; } 20%, 72% { opacity:1; } 80%, 100% { opacity:0; } }

/* blackhole: a note dragged into the corner is swallowed; the hole swells while held. */
.uju-hole { position:absolute; z-index:1; right:0; top:0; width:120px; height:120px; border-radius:50%; background:#000; translate:50% -50%; }
.uju[data-state="blackhole"] .uju-hole { animation:uju-swell 2400ms linear forwards; }
@keyframes uju-swell { 0%, 40% { width:120px; height:120px; } 46%, 76% { width:160px; height:160px; } 82%, 100% { width:120px; height:120px; } }
.uju[data-state="blackhole"] .uju-star--f { animation:uju-drag-f 2400ms var(--ease) forwards; }
@keyframes uju-drag-f { 0%, 18% { left:560px; top:95px; scale:1; opacity:1; } 62% { left:610px; top:30px; scale:1; opacity:1; } 80%, 100% { left:636px; top:4px; scale:0; opacity:0; } }
.uju[data-state="list"] .uju-star--f { opacity:0; }

/* The pointer that does the dragging, one path per state. */
.uju-cursor { position:absolute; z-index:2; left:0; top:0; width:16px; height:22px; opacity:0; pointer-events:none; }
.uju[data-state="planet"] .uju-cursor { animation:uju-cursor-e 2400ms var(--ease) forwards; }
.uju[data-state="constellation"] .uju-cursor { animation:uju-cursor-d 2400ms var(--ease) forwards; }
.uju[data-state="blackhole"] .uju-cursor { animation:uju-cursor-f 2400ms var(--ease) forwards; }
@keyframes uju-cursor-e { 0% { opacity:0; left:560px; top:240px; } 12%, 18% { opacity:1; left:549px; top:219px; } 75% { opacity:1; left:calc(var(--lx, 149px) + 4px); top:calc(var(--ly, 121px) + 4px); } 88% { opacity:1; } 100% { opacity:0; left:calc(var(--lx, 149px) + 4px); top:calc(var(--ly, 121px) + 4px); } }
@keyframes uju-cursor-d { 0% { opacity:0; left:600px; top:390px; } 12%, 18% { opacity:1; left:589px; top:369px; } 72% { opacity:1; left:454px; top:304px; } 86% { opacity:1; } 100% { opacity:0; left:454px; top:304px; } }
@keyframes uju-cursor-f { 0% { opacity:0; left:575px; top:120px; } 12%, 18% { opacity:1; left:564px; top:99px; } 62%, 80% { opacity:1; left:614px; top:34px; } 100% { opacity:0; left:590px; top:70px; } }

/* App chrome: menu button, logo, the note on the right, the list on the left. */
.uju-menu { position:absolute; z-index:4; left:14px; top:14px; width:30px; height:30px; display:grid; place-items:center; border-radius:6px; background:#4D4D4D; transition:left 600ms var(--ease); }
.uju-menu svg { width:14px; height:14px; }
.uju[data-state="list"] .uju-menu { left:178px; }
.uju .uju-logo { position:absolute; z-index:1; left:50%; top:18px; width:auto; max-width:none; height:16px; margin:0; border-radius:0; background:none; translate:-50% 0; }
.uju-note, .uju-list { position:absolute; z-index:3; top:10px; bottom:10px; transition:translate 600ms var(--ease), opacity 300ms; }
.uju-note { right:10px; width:228px; padding:12px 16px; border-radius:6px; background:#fff; box-shadow:0 2px 8px rgba(0,0,0,.1); translate:110% 0; opacity:0; }
.uju[data-state="star"] .uju-note { translate:0 0; opacity:1; }
.uju-tools { display:flex; gap:10px; align-items:center; margin-bottom:12px; }
.uju-tools svg { width:13px; height:13px; }
.uju-tools .close { margin-left:auto; }
.uju-note h4 { margin:0 0 10px; font-size:17px; font-weight:700; line-height:1.4; }
.uju-note pre { margin:0; font:400 12px/1.7 Menlo, monospace; white-space:pre-wrap; color:#333; }
.uju-note pre::after { content:''; display:inline-block; width:1px; height:13px; margin-left:1px; vertical-align:-2px; background:#333; animation:uju-caret 1s steps(1) infinite; }
@keyframes uju-caret { 50% { opacity:0; } }
.uju-list { left:0; top:0; bottom:0; width:168px; padding:56px 14px 14px; background:#3b3b3b; color:#eee; font-size:12px; line-height:1.4; translate:-100% 0; }
.uju[data-state="list"] .uju-list { translate:0 0; }
.uju-list ul { list-style:none; margin:0; padding:0; display:grid; gap:9px; }
.uju-list ul ul { margin-top:9px; padding-left:12px; color:#cfcfcf; }
.uju-list > ul > li { font-weight:700; }
.uju-list ul ul li { font-weight:400; }

/* Wide screens read the scene beside the text: each step leaves a little room so a state
   stays up long enough to watch before the next one takes over. */
.uju-step { display:block; }
@media (min-width:1180px) { .uju-step { height:18vh; } }

@media (prefers-reduced-motion: reduce) {
  .uju *, .uju *::before, .uju *::after { transition:none !important; animation-duration:1ms !important; animation-iteration-count:1 !important; }
}

.mini-uju { border:1px solid #3b3b47; border-radius:12px; overflow:hidden; background:#161723; margin:28px 0 12px; }
.mini-toolbar { display:flex; gap:10px; padding:14px; border-bottom:1px solid #303140; }
.mini-toolbar button { font:inherit; font-size:13px; color:#ddd; background:transparent; border:1px solid #494959; border-radius:6px; padding:6px 10px; cursor:pointer; }
.mini-toolbar button[aria-pressed=true] { background:#42415d; }
.mini-space { position:relative; aspect-ratio:600/320; }
.mini-space > svg,.mini-stars { position:absolute; inset:0; width:100%; height:100%; }
.mini-space line { stroke:#8985b2; stroke-width:1; }
.mini-star { position:absolute; transform:translate(-50%,-10px); padding:25px 6px 4px; border:0; background:none; color:#c9c7e2; font:12px var(--sans); cursor:grab; touch-action:none; }
.mini-star::before { content:''; position:absolute; width:10px; height:10px; border-radius:50%; background:#f6e7b0; top:5px; left:calc(50% - 5px); box-shadow:0 0 15px #f1dc8580; }
.mini-star[aria-pressed=true]::before { outline:1px solid #c9b4ff; outline-offset:6px; }
.mini-editor { display:grid; gap:8px; padding:16px; font-size:12px; color:#aaa8c0; border-top:1px solid #303140; }
.mini-editor input,.mini-editor textarea { width:100%; border:1px solid #454356; background:#1d1d2b; color:#eee; border-radius:5px; padding:9px; font:14px/1.6 var(--sans); resize:vertical; }
.mini-uju .mini-status { padding:0 16px 14px; margin:0; font-size:12px; min-height:32px; color:#aaa8c0; }
.essay .mini-caption { font-size:13px; color:var(--muted); }

/* Match the interactive demo's visible chrome and graphic treatment. */
.uju { border-radius:8px; box-shadow:0 0 0 1px #d4d0c7; font-family:UjuNoto,sans-serif; }
.uju-hull { stroke:#ccc; stroke-width:2; stroke-dasharray:10 8; }
.uju-hull-label { font-family:UjuNoto,sans-serif; }
.uju .uju-logo { width:46px; height:auto; }
.uju-menu { left:16px; top:16px; width:36px; height:36px; border-radius:8px; }
.uju-add-art { position:absolute; right:18px; bottom:18px; width:48px; height:48px; display:grid; place-items:center; border-radius:50%; color:#fff; background:#4d4d4d; }
.uju-add-art svg { width:24px; height:24px; }
.uju-zoom-art { position:absolute; right:20px; top:50%; translate:0 -50%; width:28px; height:120px; border-radius:8px; background:#e5e5e1; box-shadow:0 0 4px #0001; }
.uju-zoom-art::before { content:''; position:absolute; top:14px; bottom:14px; left:12px; width:4px; background:#c5c5c5; border-radius:2px; }
.uju-zoom-art i { position:absolute; top:82px; left:8px; width:12px; height:12px; border-radius:50%; background:#4d4d4d; }

/* Reveal explanatory planets together with their parent orbit. */
.uju-star--p, .uju-star--e.uju-orbiting { visibility:hidden; }
.uju-world:has(.uju-star--a:hover) .uju-star--p,
.uju-world:has(.uju-star--p:hover) .uju-star--p,
.uju-world:has(.uju-star--e:hover) .uju-star--p,
.uju-world:has(.uju-star--a:hover) .uju-star--e.uju-orbiting,
.uju-world:has(.uju-star--p:hover) .uju-star--e.uju-orbiting,
.uju-world:has(.uju-star--e:hover) .uju-star--e.uju-orbiting { visibility:visible; }
.uju-star--a::after { content:''; position:absolute; left:-45px; top:-45px; width:90px; height:90px; border-radius:50%; }

/* Pause at the current frame when this explanation is not being read. */
.uju.is-motion-paused *, .uju.is-motion-paused *::before, .uju.is-motion-paused *::after { animation-play-state:paused!important; }
