/* A single tabletop, expressed in desk-plane coordinates. The camera frames its physical props. */
.sg-viewport {
  position: absolute; inset: 0; overflow: hidden; isolation: isolate;
  background: #926a48; color: var(--ink); direction: ltr;
}
.sg-viewport, .sg-viewport :is(.sg-manuscript,.sg-handset,.sg-display,.sg-base,.sg-sheet,.sg-keys,.sg-coffee,.sg-cup,.sg-pen) { box-sizing: border-box; }
.sg-camera { position: absolute; inset: 0; overflow: visible; perspective: 3400px; perspective-origin: 50% 50%; }
.sg-world {
  position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d; transform-origin: 0 0;
  transition: transform 1020ms cubic-bezier(.37,.02,.16,1);
}
.sg-world > * { position: absolute; top: 0; left: 0; }
.sg-desktop {
  width: 4500px; height: 3350px; margin: -1675px 0 0 -2250px;
  transform: translateZ(-5px); pointer-events: none;
  background-color: #a6805b;
  background-image: radial-gradient(ellipse at 22% 31%,#ffe0a74f 0,transparent 41%), radial-gradient(ellipse at 77% 70%,#38231e55,transparent 55%), url('assets/scene/oak.webp');
  background-size: cover,cover,1120px 736px;
}
.sg-desktop::after {
  content:""; position:absolute; inset:0;
  background:linear-gradient(117deg, transparent 12%,#ffe8c023 19%,#ffeab31a 26%,transparent 37%,#432e1e09 57%,#32222414 72%);
}
.sg-blotter {
  margin: -212px 0 0 -328px; width: 1590px; height: 948px; border-radius: 27px;
  background: radial-gradient(ellipse at 15% 0,#52757155,transparent 65%), linear-gradient(133deg,#44635e,#3f5750 75%,#32473f);
  box-shadow: inset 0 0 0 1px #74918a, inset 0 -6px 3px #283c35, 2px 9px 9px #46321f35;
  transform: translate3d(0,-36px,-1px) rotate(-4deg); pointer-events: none;
}
.sg-blotter::before {
  content:""; position:absolute; inset:6px; border:1px dashed #a9b8a15e; border-radius:20px;
}
.sg-blotter::after { content:""; position:absolute; inset:0; border-radius:inherit; opacity:.12; background-image:url('assets/scene/oak.webp'); mix-blend-mode:luminosity; background-size:240px; }
.sg-manuscript {
  width: var(--sg-pw); height: var(--sg-ph); margin-left: calc(var(--sg-pw) / -2); margin-top: calc(var(--sg-ph) / -2);
  transform: translate3d(var(--sg-paper-x),var(--sg-paper-y),var(--sg-paper-z)) rotateZ(var(--sg-paper-roll));
  transform-style: preserve-3d;
}
.sg-paper-shadow {
  width: var(--sg-pw); height: var(--sg-ph); margin-left: calc(var(--sg-pw) / -2); margin-top: calc(var(--sg-ph) / -2);
  transform: translate3d(calc(var(--sg-paper-x) + 5px),calc(var(--sg-paper-y) + 9px),1px) rotate(-7deg);
  box-shadow: 0 9px 24px 3px #4634214d; pointer-events:none;
}
.sg-sheet { position:absolute; inset:0; background:#e9e5d9; border:1px solid #b5b1a3; pointer-events:none; }
.sg-sheet-second { transform: translate3d(-7px,5px,-3px) rotate(-2.5deg); }
.sg-sheet-third { transform: translate3d(2px,3px,-1px) rotate(.8deg); background:#fcf8ea; box-shadow:1px 2px 2px #8e827b50; }
.sg-paper-screen {
  width:100%; height:100%; background:#fffef8; overflow:auto; position:relative;
  border-radius:1.5px; box-shadow:0 0 0 .8px #b8ad9566,1px 2px 4px #8e827b4d;
  container:article-paper / size; scrollbar-width:thin; scrollbar-color:#b5b4a3 transparent;
}
.sg-pen {
  width: 13px; height: 222px; transform: translate3d(calc(var(--sg-paper-x) + var(--sg-pw) / 2 + 34px),calc(var(--sg-paper-y) - 35px),8px) rotate(-15deg);
  border-radius:6px 6px 4px 4px; background: linear-gradient(90deg,#1f302b,#596057 28%,#263d36 61%,#152924); box-shadow:3px 6px 6px #39271360;
  pointer-events:none;
}
.sg-pen::before { content:""; position:absolute; top:0; left:8px; height:60px; width:2px; border-radius:0 0 5px 5px; background:linear-gradient(#e8c585,#8a775b); box-shadow:1px 0 1px #322e24; }
.sg-pen::after { content:""; position:absolute; bottom:54px; left:0; width:100%; height:3px; background:linear-gradient(90deg,#926d3f,#f0d294,#887245); }
.sg-pen i { position:absolute; top:62px; left:0; width:100%; height:2px; background:#bea576; }
.sg-pen b { position:absolute; bottom:-12px; left:2px; width:9px; height:16px; clip-path:polygon(0 0,100% 0,52% 100%); background:linear-gradient(90deg,#8b7448,#e3bd7e 60%,#372e25); }
.sg-glasses {
  width:165px; height:77px; transform:translate3d(calc(var(--sg-paper-x) - 128px),calc(var(--sg-paper-y) - var(--sg-ph) / 2 - 109px),18px) rotate(-8deg); pointer-events:none;
}
.sg-glasses i { display:block; position:absolute; top:17px; width:73px; height:51px; border:4px solid #5f4936; border-top-color:#49392f; border-bottom-width:3px; border-radius:30% 33% 44% 46%; background:linear-gradient(135deg,#f4eee42a,#a4bbb921 72%,#fff1c83b); box-shadow:2px 4px 3px #39281746,inset 0 0 0 1px #ccac78; }
.sg-glasses i:first-child { left:0; transform:rotate(3deg); }
.sg-glasses i:nth-child(2) { right:0; transform:rotate(-4deg); }
.sg-glasses b { position:absolute; top:29px; left:69px; border-top:3px solid #745f43; border-radius:50%; width:27px; height:12px; }
.sg-glasses em { position:absolute; top:17px; height:3px; width:70px; border-radius:3px; background:#51402e; box-shadow:2px 4px 2px #3e2d243b; transform:rotate(-27deg); transform-origin:left; }
.sg-glasses em:last-child { right:0; transform:rotate(27deg); transform-origin:right; }
.sg-coffee {
  width:124px; height:124px; border-radius:50%; transform:translate3d(calc(var(--sg-laptop-x) + var(--sg-lw) / 2 + 47px),calc(var(--sg-laptop-y) - 308px),4px) rotate(13deg);
  background:linear-gradient(145deg,#b3895f,#815c41); box-shadow:inset 0 2px 2px #e3c19d99,inset 0 0 0 4px #a67b52,3px 6px 6px #45332070; pointer-events:none;
}
.sg-cup-handle { width:44px; height:30px; position:absolute; top:46px; right:-17px; border:6px solid #e5ded1; border-left:1px solid #bcb4a9; border-radius:39%; box-shadow:inset 1px 2px 2px #8c8276,2px 4px 6px #69584677; }
.sg-cup { position:absolute; inset:9px; border-radius:50%; background:linear-gradient(145deg,#fffdf2,#d0c6af 80%,#9b8d76); border:2px solid #f0ecde; box-shadow:5px 9px 9px #3e2c2080; }
.sg-cup i { position:absolute; inset:8px; border-radius:50%; background: radial-gradient(ellipse at 25% 24%,#83654a 0 2%,transparent 12%), radial-gradient(ellipse at 71% 69%,#2b211b 10%,#35251c 59%,#644632 80%,#a0784b 89%); box-shadow:inset 0 3px 5px #271a12,0 0 0 2px #74634c; }
.sg-phone-shadow {
  width:329px; height:584px; margin:-280px 0 0 -153px; transform:translate3d(var(--sg-phone-x),var(--sg-phone-y),3px) rotate(var(--sg-phone-roll));
  border-radius:48px; background:#14251f22; box-shadow:9px 21px 19px #19251e55; pointer-events:none;
}
.sg-handset {
  width:326px; height:600px; margin:-300px 0 0 -163px; padding:5px;
  background:linear-gradient(118deg,#c9ccc4 0,#818781 9%,#aeb5a9 18%,#535b56 62%,#313c38 91%,#9b9e93); border:1px solid #464f49; border-radius:42px;
  transform:translate3d(var(--sg-phone-x),var(--sg-phone-y),var(--sg-phone-z)) rotateZ(var(--sg-phone-roll)) rotateX(var(--sg-phone-tilt));
  box-shadow:inset 0 1px 1px 1px #e1e0d5a8, inset 0 -2px 1px 1px #3c443e,2px 4px 0 #3b4641;
}
.sg-volume { position:absolute; left:-3px; top:86px; height:24px; width:2px; background:#67726b; box-shadow:0 41px 0 #77837a,0 60px 0 #77837a; border-radius:2px; }
.sg-handset-glass { position:relative; box-sizing:border-box; height:100%; border:1px solid #303b36; padding:18px 6px 14px; border-radius:36px; background:linear-gradient(130deg,#182525,#101a1a 70%,#21302c); box-shadow:inset 0 0 0 1px #4e57524d; }
.sg-speaker { position:absolute; width:39px; height:3px; top:6px; left:calc(50% - 20px); background:#3b4846; border-radius:4px; box-shadow: 0 1px 1px #6d767126; }
.sg-speaker i { display:block; position:absolute; right:-12px; top:-.6px; width:4px; height:4px; border-radius:50%; background:#35473f; box-shadow: inset 0 0 1px 1px #101b16; }
.sg-phone-screen { position:relative; box-sizing:border-box; width:100%; height:100%; overflow:auto; scrollbar-width:none; border-radius:24px; background:var(--bg); container:phone-display / size; }
.sg-phone-screen::-webkit-scrollbar { display:none; }
.sg-home { position:absolute; width:65px; height:3px; background:#a0aba4; bottom:5px; left:calc(50% - 32px); border-radius:3px; }
.sg-machine {
  width:0; height:0; transform: translate3d(var(--sg-laptop-x),var(--sg-laptop-y),var(--sg-laptop-z)) rotateZ(var(--sg-laptop-roll));
  transform-style:preserve-3d;
}
.sg-computer-shadow { position:absolute; left:calc(var(--sg-lw) / -2 - 20px); top:-43px; width:calc(var(--sg-lw) + 64px); height:calc(var(--sg-lh) * .68); border-radius:20px; box-shadow:0 15px 22px #1b231d70; background:#1d2a244a; transform:translateZ(1px); pointer-events:none; }
.sg-display {
  position:absolute; left:calc(var(--sg-lw) / -2 - 9px); bottom:0; width:calc(var(--sg-lw) + 18px); height:calc(var(--sg-lh) + 28px);
  border-radius:15px 15px 6px 6px; border:1px solid #4b5650; padding:13px 8px;
  background:linear-gradient(127deg,#38433f,#1c2a29 17%,#172323 69%,#24312e);
  box-shadow:inset 0 1px 0 1px #7c837a,inset 0 -4px 0 #38443f,0 2px 1px #1b2522;
  transform:rotateX(var(--sg-screen-tilt)); transform-origin: bottom center;
}
.sg-webcam { position:absolute; left:calc(50% - 2px); top:4px; width:4px; height:4px; background:#46554f; border-radius:50%; box-shadow:inset 0 0 1px 1px #17251e; }
.sg-display-screen { position:relative; width:100%; height:100%; overflow:auto; scrollbar-width:thin; scrollbar-color:var(--border) transparent; border-radius:5px; background:var(--bg); container:laptop-display / size; }
.sg-hinge { position:absolute; width:74%; min-width:calc(var(--sg-lw) * .74); height:8px; left:calc(var(--sg-lw) * -.37); top:-3px; background:linear-gradient(#1d2e2d,#687571,#36443e); border-radius:3px; transform:translateZ(8px); pointer-events:none; }
.sg-base {
  position:absolute; top:-2px; left:calc(var(--sg-lw) / -2 - 12px); width:calc(var(--sg-lw) + 24px); height:calc(var(--sg-lh) * .63); border-radius:4px 4px 22px 22px;
  background:linear-gradient(118deg,#c1c5bb,#9fa79f 24%,#b1b7ad 47%,#929d95 96%);
  border:1px solid #79877c; box-shadow:inset 0 2px 3px #f2f2df55,inset 0 -5px 2px #d5d7ce,0 4px 0 #657267; transform:translateZ(3px); pointer-events:none;
}
.sg-base::after { content:""; position:absolute; bottom:0; left:42%; width:16%; height:4px; border-radius:3px 3px 0 0; background:#86938a; }
.sg-keys { position:absolute; left:7%; right:7%; top:7%; height:55%; display:flex; flex-direction:column; gap:3px; padding:3px; background:#778179; box-shadow:inset 0 2px 3px #52635b; border-radius:6px; }
.sg-keyrow { display:flex; flex:1; gap:3px; min-height:0; }
.sg-keyrow i { display:block; flex-basis:0; border-radius:3px; background:linear-gradient(140deg,#394641,#273632 80%); box-shadow:inset 0 1px 0 #59625a,0 1px 0 #16211c; }
.sg-trackpad { position:absolute; top:67%; left:37%; width:26%; height:28%; border:1px solid #89968c; background:#b1bab044; border-radius:4px; }
.sg-room-grade { position:absolute; inset:0; pointer-events:none; background:radial-gradient(ellipse at 47% 36%,transparent 51%,#36291c23 100%); }
/* The ink on the photographed manuscript uses the same DOM as the live printed page.
   Matrix corners in the original 1672 × 941 photograph: (566,214), (930,241),
   (835,787), (457,734). The mask follows Sara's thumb and left fingertips. */
.sg-establishing {
  position:absolute; inset:0; pointer-events:none; opacity:0; overflow:hidden;
  background:#80694e;
  transform:translate(var(--sg-match-dx),var(--sg-match-dy)) scale(1.69);
  transform-origin:var(--sg-match-x) var(--sg-match-y);
  transition:opacity 580ms 100ms ease-in-out,transform 920ms cubic-bezier(.35,.03,.16,1);
}
.sg-photograph {
  position:absolute; width:1672px; height:941px; top:var(--sg-photo-top); left:var(--sg-photo-left);
  transform-origin:top left; transform:scale(var(--sg-photo-scale));
  background:url('assets/student-desk.webp') 0 0 / 100% 100% no-repeat;
}
.sg-ink-mask {
  position:absolute; inset:0;
  clip-path:path('M566 214 L930 241 L874 580 Q864 567 854 578 Q848 582 849 600 Q851 618 845 644 Q836 664 835 690 L836 736 Q813 737 798 750 Q782 761 774 783 L585 755 Q554 737 527 738 Q514 739 505 745 L457 734 Z');
}
.sg-printed-in-photo {
  position:absolute; left:0; top:0; width:600px; height:710px; transform-origin:0 0;
  transform:matrix3d(.5400547,.0277382,0,-.00007162576,-.1843125,.6829396,0,-.0000673771,0,0,1,0,566,214,0,1);
  container:photo-print / size; filter:sepia(.21) saturate(.73) contrast(.88) brightness(.86);
}
.sg-printed-in-photo:not(:empty)::after { content:""; position:absolute; inset:0; background:linear-gradient(117deg,#caa37121,#93694012 55%,#7154382e); pointer-events:none; }
.sg-photo-loaded[data-shot="opening"] .sg-establishing { opacity:1; transform:none; transition-delay:0ms; }
.sg-viewport[data-shot="abstract"] .sg-world { transition-duration:320ms; }
.sg-keyrow i { position:relative; }
.sg-keyrow i::before { content:attr(data-legend); position:absolute; top:13%; left:13%; color:#d4d7cbba; font:500 clamp(4px,calc(var(--sg-lw) * .009),9px)/1 Arial,sans-serif; }
.sg-viewport[data-shot="paper"] :is(.sg-phone-screen,.sg-display-screen),
.sg-viewport[data-shot="phone"] :is(.sg-paper-screen,.sg-display-screen),
.sg-viewport:is([data-shot="laptop"],[data-shot="director"]) :is(.sg-paper-screen,.sg-phone-screen) {
  filter:blur(.85px) saturate(.83) brightness(.97);
}
@media (max-width: 700px) {
  .sg-room-grade { background:radial-gradient(ellipse at 48% 40%,transparent 64%,#36291c15 100%); }
}
@media (prefers-reduced-motion: reduce) {
  .sg-world,.sg-establishing { transition:none; }
}

.sg-computer-in-photo {
  width:860px; height:490px; position:absolute; left:0; top:0;
  transform:matrix3d(0.230782329,-0.00971404593,0,-8.69660407e-05,-0.0648437884,0.386538685,0,-1.81776781e-05,0,0,1,0,1008,322,0,1); transform-origin:0 0;
  overflow:hidden; container:photo-monitor / size; filter:brightness(.67) saturate(.63);
}
.sg-computer-in-photo:not(:empty)::after { content:""; position:absolute; inset:0; background:linear-gradient(110deg,#a9c3b325,transparent 50%,#b5beac14); }
[data-sg-focused] { outline:2px solid var(--focus) !important; outline-offset:3px; }
@keyframes sg-return-to-desk {
  0% { opacity:0; transform:scale(1.04); }
  24%,42% { opacity:1; transform:scale(1); }
  100% { opacity:0; transform:translate(var(--sg-match-dx),var(--sg-match-dy)) scale(1.69); }
}
@media (prefers-reduced-motion:no-preference) {
  .sg-photo-loaded[data-shot="ending"][data-desk-return="true"] .sg-establishing { animation:sg-return-to-desk 1800ms cubic-bezier(.32,.03,.16,1) both; }
}
/* Step close to the phone in portrait without a foreground lid crossing its controls. */
.sg-viewport[data-format="portrait"]:not([data-chat-active="true"]) .sg-machine > div { transition:opacity 300ms ease; }
.sg-viewport[data-format="portrait"][data-shot="phone"] .sg-machine > div { opacity:0; pointer-events:none; }
@media (prefers-reduced-motion:reduce) {
  .sg-viewport[data-format="portrait"]:not([data-chat-active="true"]) .sg-machine > div { transition:none; }
}
.sg-exhibit{width:900px;height:555px;margin:-277.5px 0 0 -450px;transform:translate3d(-500px,-900px,14px);transform-style:preserve-3d}
#exhibitSurface{width:100%;height:100%;container:exhibition / size;direction:rtl;position:relative;text-align:right}
.sg-viewport[data-format=portrait] .sg-exhibit{width:440px;height:610px;margin:-305px 0 0 -220px}
.sg-viewport[data-format=portrait][data-chat-active=true] .sg-world{inset:0;width:100%;height:100%;transform:none!important;transform-style:flat}
.sg-viewport[data-format=portrait][data-chat-active=true] .sg-world>:not(.sg-desktop,.sg-handset,.sg-machine){display:none}
.sg-viewport[data-format=portrait][data-chat-active=true] .sg-handset{left:50%;top:var(--sg-flow-phone-top);width:var(--sg-flow-phone-width);height:var(--sg-flow-phone-height);margin:0;transform:translateX(-50%) rotate(-.6deg);border-radius:23px}
.sg-viewport[data-format=portrait][data-chat-active=true] .sg-handset-glass{border-radius:18px;padding:9px 4px 7px}
.sg-viewport[data-format=portrait][data-chat-active=true] .sg-phone-screen{border-radius:12px}
.sg-viewport[data-format=portrait][data-chat-active=true] .sg-machine{left:3%;top:var(--sg-flow-laptop-top);width:94%;height:47%;transform:rotate(.4deg)}
.sg-viewport[data-format=portrait][data-chat-active=true] .sg-display{inset:0;width:100%;height:100%;padding:8px 5px 5px;transform:none}
.sg-viewport[data-format=portrait][data-chat-active=true] .sg-base{left:-1%;top:99%;width:102%;height:10px;transform:none}
.sg-viewport[data-format=portrait][data-chat-active=true] .sg-machine :is(.sg-keys,.sg-computer-shadow,.sg-hinge,.sg-trackpad){display:none}
.sg-viewport[data-shot=exhibit] :is(.sg-machine,.sg-handset,.sg-phone-shadow){visibility:hidden}

/* These two shots share the same live devices, scroll position and camera clock. */
.sg-viewport[data-chat-active=true] .sg-machine>div {opacity:var(--sg-device-reveal);}
.sg-viewport[data-chat-active=true] .sg-manuscript {filter:brightness(var(--sg-surround-light));}
.sg-viewport[data-chat-active=true]:is([data-shot=chatPull],[data-shot=flow]) .sg-world {transition:none}
.sg-viewport[data-shot=chatClose] .sg-paper-screen {filter:blur(2px)}
.sg-viewport[data-shot=chatClose] .sg-room-grade {background:radial-gradient(ellipse at center,transparent 25%,#1d241b44 90%)}
