/* Optional companions stay clear of the book, notes, and room controls. */
.desk-companion-control {
  display:inline-flex; flex-wrap:wrap; align-items:center; gap:.35rem .6rem;
  min-width:0; font:500 .875rem/1.35 var(--sans,system-ui,sans-serif);
}
.desk-companion-toggle {
  min-height:44px; max-width:100%; padding:.35rem .6rem;
  border:1px solid var(--rule,#b9c7d7); border-radius:3px;
  background:var(--surface,#f9fbfe); color:var(--ink,#11243e); font:inherit;
}
.desk-companion-control--overview {margin-inline-start:auto}
.seated-view-tools {flex-wrap:wrap}
.seated-view-tools .desk-companion-control {
  padding-inline:.55rem; background:#10253deb; color:#f2f7ff;
  border:1px solid #ffffff8f; border-radius:3px;
}
.seated-view-tools .desk-companion-toggle {
  color-scheme:dark; background:#172b40; color:#f2f7ff; border:0; min-width:6.4rem;
}
html[data-gallery-finish="amber"] .seated-view-tools .desk-companion-control,
html[data-gallery-finish="amber"] .seated-view-tools .desk-companion-toggle {background:#302b2b}
.desk-companion-toggle:focus-visible {outline:2px solid currentColor;outline-offset:2px}
.desk-companions {pointer-events:none;user-select:none;-webkit-user-select:none;isolation:isolate}
.desk-companions[hidden],.desk-companions [hidden],.desk-companion-actions[hidden] {display:none!important}
.desk-companions--overview {position:absolute;inset:0;z-index:2}
.desk-companions .desk-companion {position:absolute;margin:0}
.desk-companions .desk-companion-touch {
  pointer-events:auto; display:block; position:relative; padding:0; margin:0;
  width:100%; height:100%; min-width:44px; min-height:44px;
  background:transparent; border:0; border-radius:.3rem; box-shadow:none;
  cursor:pointer; touch-action:manipulation; -webkit-tap-highlight-color:transparent;
}
.desk-companions .desk-companion-touch:hover {background:transparent}
.desk-companions .desk-companion-touch:focus-visible {outline:2px solid #e0efff;outline-offset:3px;box-shadow:0 0 0 5px #10243caa}
.desk-companions .desk-companion-touch > img {
  display:block; width:100%; height:100%; max-width:100%; object-fit:contain; object-position:center bottom;
  pointer-events:none;
}
/* The overview route starts behind the chair and ends before the folio.
   The fleck of shadow below the paws follows the near edge of the desktop. */
.desk-companions .desk-companion-trail {
  position:absolute;overflow:visible;clip-path:inset(0 0 -14% 0);pointer-events:none;direction:ltr;
}
.desk-companions[data-ermine-elsewhere] .desk-companion-trail {visibility:hidden}
.desk-companions--overview .desk-companion-trail {left:41.6%;width:46%;bottom:35.8%;height:22%}
.desk-companions .desk-companion--ermine {
  left:-55%;bottom:0;width:18%;transform-origin:50% 96%;height:auto;aspect-ratio:16/9;
}
.desk-companions .desk-companion--ermine[data-visit="away"] {visibility:hidden}
.desk-companions .desk-companion-touch {min-width:0;min-height:0;transform:scaleX(var(--ermine-facing,1))}
.desk-companions .desk-companion-touch::before {
  content:"";position:absolute;left:49%;bottom:3.5%;width:49%;height:6%;
  transform:translateX(-50%);border-radius:50%;pointer-events:none;
  background:radial-gradient(ellipse,#170e087a 3%,#291c1240 46%,transparent 74%);
}
.desk-companions .desk-companion[data-action="rest"] .desk-companion-touch::before,
.desk-companions .desk-companion[data-visit="napping"] .desk-companion-touch::before {width:38%;height:8%}
.desk-companions .desk-ermine-film {
  position:absolute;inset:0;display:block;overflow:hidden;pointer-events:none;
  transform-origin:50% 95%;filter:drop-shadow(0 .45px .5px #19110955);
}
.desk-companions .desk-ermine-film .desk-ermine-frames {
  display:block;position:absolute;inset:0 auto auto 0;width:400%;height:400%;max-width:none;
  object-fit:fill;pointer-events:none;transition:none;
}
.desk-companions .desk-ermine-reflection {
  position:absolute;inset:0;display:block;pointer-events:none;background-size:400% 400%;
  transform-origin:50% 95%;transform:scaleY(-.38);filter:blur(.65px) saturate(.65);opacity:.19;
  -webkit-mask-image:linear-gradient(to top,transparent 0,#000 5%,#0009 17%,transparent 46%);
  mask-image:linear-gradient(to top,transparent 0,#000 5%,#0009 17%,transparent 46%);
}
.desk-companions .desk-companion-touch::after {
  content:"";position:absolute;left:50%;bottom:0;transform:translateX(-50%);
  width:max(100%,44px);height:max(100%,44px);
}
.desk-companion-call {
  font:inherit;color:inherit;background:transparent;border:0;text-decoration:underline;
  text-underline-offset:.2em;cursor:pointer;min-height:44px;padding:.2rem .45rem;
}
.desk-companion-call[hidden] {display:none!important}
.desk-companion-call:focus-visible {outline:2px solid currentColor;outline-offset:2px}
/* The seated animals occupy a tabletop view above the book, never the reading surface. */
.volume-setting:has(>.desk-companions--seated:not([hidden])) {display:flex;flex-direction:column}
.volume-setting:has(>.desk-companions--seated:not([hidden]))>.seated-view-tools {order:0;width:100%}
.volume-setting:has(>.desk-companions--seated:not([hidden]))>.open-volume {order:2;width:100%;box-sizing:border-box;min-width:0}
.desk-companions--seated {
  order:1;position:relative;width:100%;max-width:54rem;height:auto;aspect-ratio:3/1;
  margin:.25rem auto .9rem;overflow:hidden;
  background:var(--desk-day) center/cover no-repeat;
}
html[data-hall-light="night"] .desk-companions--seated {background-image:var(--desk-night)}
.desk-companions--seated .desk-companion-trail {left:0;bottom:2%;width:57%;height:55%}
.desk-companions--seated .desk-companion--ermine {width:29%}
html[data-hall-light="night"] .desk-companions .desk-companion-touch > img,
html[data-hall-light="night"] .desk-companions .desk-ermine-film {
  filter:brightness(.76) saturate(.82) drop-shadow(0 .65px .7px #080a1199)
}
.desk-companion-actions {
  flex:1 0 100%;min-width:0;box-sizing:border-box;display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:.2rem .85rem;
  padding:.6rem 0 .35rem;border-block-start:1px solid var(--rule,#b9c7d7);color:inherit;
  font:400 .875rem/1.4 var(--sans,system-ui,sans-serif);
}
.desk-companion-actions-title {font:600 1rem/1.3 var(--sans,system-ui,sans-serif);margin:0}
.desk-companion-action-buttons {display:flex;flex-wrap:wrap;gap:.35rem}
.desk-companion-actions :is(.desk-companion-action,.desk-companion-close) {
  min-height:44px;min-width:44px;margin:0;padding:.4rem .8rem;border:1px solid var(--rule,#b9c7d7);
  border-radius:3px;font:500 .875rem/1.25 var(--sans,system-ui,sans-serif);
  color:inherit;background:transparent;cursor:pointer;text-underline-offset:.2em;
}
.desk-companion-actions :is(.desk-companion-action,.desk-companion-close):hover {background:var(--ground,#e9eff6)}
.desk-companion-actions :is(.desk-companion-action,.desk-companion-close):focus-visible {outline:2px solid currentColor;outline-offset:2px}
.desk-companion-actions .desk-companion-close {justify-self:end;text-decoration:underline;border-color:transparent}
.desk-companion-status {grid-column:1/-1;margin:.15rem 0 0;color:inherit;opacity:.82;min-height:1.4em}
.seated-view-tools .desk-companion-actions {padding:.55rem .65rem;background:#10243ced;color:#f2f7ff;border:1px solid #b3c8df77;border-radius:3px}
html[data-gallery-finish="amber"] .seated-view-tools .desk-companion-actions {background:#302b2bef}
.seated-view-tools .desk-companion-actions button {margin-inline-end:0}
.seated-view-tools .desk-companion-actions button:hover {background:#ffffff14}
@media(prefers-reduced-motion:no-preference) {
  .desk-companions .desk-companion--ermine[data-visit="watching"]:not([data-ermine-asleep]) .desk-ermine-film {
    animation:desk-ermine-breathe 3.8s ease-in-out infinite;
  }
}
html[data-light-paused] .desk-companions .desk-ermine-film,
.desk-companions[data-companion-still] .desk-ermine-film {animation-play-state:paused!important}
@keyframes desk-ermine-breathe {0%,100%{transform:scaleY(1)}48%{transform:scaleY(1.009)}}
@media(max-width:720px) {
  .desk-companion-control--overview {margin-inline-start:0;padding-block:.2rem}
  .seated-view-tools .desk-companion-control {flex:1 1 100%;justify-content:space-between}
  .desk-companions--seated {aspect-ratio:1.6/1;margin-block-end:.75rem}
  .desk-companions--seated .desk-companion-trail {width:56%;height:43%;bottom:3%}
  .desk-companions--seated .desk-companion--ermine {width:43%}
  .desk-companion-actions {grid-template-columns:minmax(0,1fr) auto;gap:.35rem}
  .desk-companion-actions-title {grid-column:1;grid-row:1}
  .desk-companion-actions .desk-companion-close {grid-column:2;grid-row:1}
  .desk-companion-action-buttons {grid-column:1/-1;grid-row:2}
  .desk-companion-actions .desk-companion-action {flex:1 1 auto;padding-inline:.55rem}
}
@media(forced-colors:active) {
  .desk-companion-control,.desk-companion-toggle,.desk-companion-actions,
  .seated-view-tools .desk-companion-control,.seated-view-tools .desk-companion-toggle,
  .seated-view-tools .desk-companion-actions,.desk-companion-actions button {
    background:Canvas;color:CanvasText;border:1px solid CanvasText;
  }
  .desk-companions .desk-companion-touch:focus-visible {outline-color:Highlight}
}

.desk-companion-actions[hidden]{display:none!important}
.desk-companion-actions{grid-template-columns:auto minmax(0,1fr) auto;grid-template-areas:"portrait title close" "portrait actions actions" "portrait status status"}
.desk-ermine-portrait{grid-area:portrait;align-self:center;width:clamp(5.5rem,13vw,9rem);aspect-ratio:16/9;background-color:#253647;background-repeat:no-repeat;background-size:400% 400%;background-position:100% 66.6667%;border:1px solid var(--rule,#708093);border-radius:4px;transform-origin:50% 87%}
.desk-companion-actions-title{grid-area:title}
.desk-companion-actions .desk-companion-close{grid-area:close}
.desk-companion-action-buttons{grid-area:actions}
.desk-companion-status{grid-area:status}
@media(max-width:540px){
 .desk-companion-actions{grid-template-areas:"portrait title close" "portrait status status" "actions actions actions"}
 .desk-companion-status{min-height:2.5em}
}

@media(prefers-reduced-motion:no-preference) {
  .desk-companion--ermine[data-ermine-asleep] .desk-ermine-film,
  .desk-companion-actions[data-ermine-asleep] .desk-ermine-portrait {
    animation:ermine-sleep-breath 5.8s ease-in-out infinite, ermine-sleep-twitch 29s ease-in-out infinite;
  }
  .desk-companion-actions[data-ermine-asleep] .desk-ermine-portrait {transform-origin:50% 95%}
}
html[data-light-paused] .desk-ermine-portrait,
.desk-companion-actions[data-companion-still] .desk-ermine-portrait {animation-play-state:paused!important}
@keyframes ermine-sleep-breath {
  0%, 100% {scale:1}
  40% {scale:1.006 1.026}
  68% {scale:1.002 1.010}
}
@keyframes ermine-sleep-twitch {
  0%, 87%, 93%, 100% {rotate:0deg}
  89% {rotate:.7deg}
  91% {rotate:-.3deg}
}
