/* WyattMail R13: focused visual refinements. Existing themes and scene artwork remain authoritative. */

/* Keep the decoded study photograph visible while the next lighting plate loads.
   scene-art.js updates data-painted-light only after that plate is ready. */
html .study-view .study-scene[data-painted-light="day"] > .study-day,
html .study-view .study-scene[data-painted-light="night"] > .study-night {
  display: block;
}

html .study-view .study-scene[data-painted-light="day"] > .study-night,
html .study-view .study-scene[data-painted-light="night"] > .study-day {
  display: none;
}

/* Load after desk-companions.css. Register the sleeping cutout to the same
   tabletop baseline as the awake atlas without changing the companion route. */
.desk-companions .desk-companion--ermine[data-ermine-asleep] .desk-companion-touch > img {
  translate: 0 12%;
  transform-origin: 50% 83%;
}

.desk-companions .desk-companion--ermine[data-ermine-asleep] .desk-companion-touch::before {
  width: 60%;
  height: 8%;
}

/* Keep the overview sleeper legible on a small screen. Seated reading keeps
   its existing dimensions, placement, and book layout. */
@media (max-width: 600px) {
  .desk-companions--overview .desk-companion--ermine {
    width: 22%;
  }
}

/* R13: library controls and responsive spacing. Load after the existing sheets. */

/* The language control currently mounts after .mast-inner. Match its gutters. */
.mast > .wm-lang {
  display:flex!important;
  width:100%;
  max-width:1600px;
  margin-inline:auto;
  padding:.1rem clamp(20px,4.4vw,84px) .45rem;
}
.mast .wm-lang select,
.mast #gallery-finish {
  min-height:44px;
  font-size:1rem;
  line-height:1.25;
}

/* Keep the search field, guide button and filters on the same control line. */
.catalog-controls .field :is(input,select) {
  min-height:48px;
  font-size:1rem;
  line-height:1.4;
  padding-block:.65rem;
}
.catalog-controls .field > label {
  margin-bottom:.375rem;
  font-size:.875rem;
  line-height:1.4;
}
#catalog-guide-slot {
  display:flex;
  flex:none;
}
#catalog-guide-slot #ask-statue {
  min-height:48px;
  padding:.25rem .7rem .25rem .45rem;
}
#catalog-guide-slot #ask-statue .ari-body {
  width:1rem;
  height:2.35rem;
}

@media(max-width:720px) {
  /* Each control keeps its place in DOM and keyboard order, including Notes. */
  .study-intro {
    gap:.5rem;
    padding-block:.6rem;
  }
  .study-intro .study-objects {
    flex:1 1 100%;
    align-items:stretch;
    gap:.4rem .5rem;
  }
  .study-intro .study-objects > :is(button,a) {
    flex:1 1 calc(50% - .25rem);
    min-width:0;
    min-height:44px;
    text-align:center;
    overflow-wrap:anywhere;
  }
  .study-intro > .desk-companion-control {
    flex:1 1 100%;
    margin-inline-start:0;
    padding-block:0;
    gap:.5rem;
    align-items:stretch;
  }
  .study-intro > .desk-companion-control > button {
    flex:1 1 0;
    min-width:0;
    min-height:44px;
    text-align:center;
    white-space:normal;
    overflow-wrap:anywhere;
  }
}

@media(max-width:680px) {
  .mast .primary {
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:.25rem;
  }
  .mast .primary > a {
    min-width:0;
    min-height:44px;
    padding-inline:.15rem;
    justify-content:center;
    text-align:center;
    font-size:.875rem;
    overflow-wrap:anywhere;
  }
  .mast .utilities > a {
    min-height:44px;
    font-size:.875rem;
  }
  .mast .library-light-choice button {
    min-height:44px;
    font-size:.875rem;
  }
}

/* Two balanced reading actions also fit the narrowest phone view. */
@media(max-width:540px) {
  .study-reading-actions { width:100%; gap:.5rem; }
  .study-reading-actions :is(#study-desk,.study-shelves) {
    flex:1 1 0;
    min-width:0;
    padding-inline:.6rem;
    font-size:.9rem;
    text-align:center;
    overflow-wrap:anywhere;
  }
}

/* Keep the three secondary header controls together at narrow phone widths. */
@media(max-width:680px) {
  .mast .utilities { column-gap:.4rem; }
  .catalog-controls > .field:last-child { grid-column:1 / -1; }
}


/* R11.7: one quiet interior Renaissance alcove, not an entrance installation. */
#collections .wm-ermine-alcove{display:grid;grid-template-columns:minmax(168px,276px) minmax(0,1fr);align-items:center;gap:clamp(20px,4vw,54px);max-width:980px;margin:clamp(32px,5vw,72px) auto;padding:clamp(20px,3.6vw,44px);background:#f7f4ec;color:#142b3e;border:1px solid rgba(65,77,86,.27);border-top:3px solid #9d8362;box-shadow:0 18px 42px rgba(15,27,43,.09)}
#collections .wm-ermine-art-panel{width:100%;min-width:0;text-align:center}
#collections .wm-ermine-art-open{display:block;width:100%;padding:10px;background:#16181b;border:1px solid #8f7656;box-shadow:0 10px 24px rgba(14,19,26,.19);cursor:zoom-in}
#collections .wm-ermine-art-open img{display:block;width:100%;height:auto;aspect-ratio:1522/2048;object-fit:contain;background:#080809}
#collections .wm-ermine-overline{font:700 10px/1.5 system-ui,sans-serif;letter-spacing:.17em;color:#7e6244;margin:0 0 .8rem}
#collections .wm-ermine-art-copy h2{font:400 clamp(25px,3vw,42px)/1.16 Georgia,'Times New Roman',serif;color:#192d42;margin:0 0 .5rem}
#collections .wm-ermine-art-copy p:not(.wm-ermine-overline){font-size:clamp(13px,1.15vw,16px);line-height:1.7;max-width:56ch;margin:0 0 .85rem}
#collections .wm-ermine-art-copy .wm-ermine-attribution{color:#665d54;font-style:italic}
#collections .wm-ermine-actions{display:flex;flex-wrap:wrap;gap:12px;align-items:center;margin:20px 0 15px}
#collections .wm-ermine-actions button{background:#18304a;border:1px solid #18304a;color:#fff;padding:11px 15px;min-height:44px;font:600 13px/1.3 system-ui,sans-serif;cursor:pointer}
#collections .wm-ermine-actions a{color:#244969;font:600 13px/1.3 system-ui,sans-serif;text-decoration:underline;text-underline-offset:3px}
#collections .wm-ermine-art-copy .wm-ermine-source{font-size:11px!important;color:#6d6963;line-height:1.6}
#collections .wm-ermine-art-open:focus-visible,#collections .wm-ermine-actions :focus-visible,.wm-ermine-viewer :focus-visible{outline:3px solid #6e99ca;outline-offset:4px}
.wm-ermine-viewer{padding:0;border:1px solid #b7a27e;border-radius:4px;box-shadow:0 24px 90px rgba(0,0,0,.7);background:#0b1119;color:#f2f4f5;width:min(96vw,1060px);max-width:1060px;height:min(93dvh,1100px);max-height:93dvh;overflow:hidden}
.wm-ermine-viewer[open]{display:grid;grid-template-rows:auto minmax(0,1fr) auto}
.wm-ermine-viewer::backdrop{background:rgba(2,8,15,.88)}
.wm-ermine-viewer-header{display:flex;justify-content:space-between;gap:12px;align-items:center;padding:12px clamp(12px,3vw,23px);background:#162230;border-bottom:1px solid #546272;min-width:0}
.wm-ermine-viewer-overline{font:650 9px/1.2 system-ui,sans-serif;text-transform:uppercase;letter-spacing:.13em;color:#cbb38b;margin:0 0 .25rem}
.wm-ermine-viewer h2{font:400 clamp(18px,3vw,26px)/1.15 Georgia,serif;color:#fff;margin:0}
.wm-ermine-viewer :is(button,output){font:600 14px/1.2 system-ui,sans-serif}
.wm-ermine-viewer button{min-width:44px;min-height:44px;cursor:pointer;background:#24394c;color:#fff;border:1px solid #77899b;padding:8px 13px;border-radius:3px}
.wm-ermine-viewer-stage{min-width:0;min-height:0;overflow:auto;overscroll-behavior:contain;display:block;text-align:center;padding:16px;background:#080c12}
.wm-ermine-viewer-stage img{display:block;margin:0 auto;height:auto;max-width:none;object-fit:contain;box-shadow:0 0 40px rgba(0,0,0,.6);width:min(100%,520px)}
.wm-ermine-viewer[data-zoom='125'] .wm-ermine-viewer-stage img{width:min(125%,650px)}
.wm-ermine-viewer[data-zoom='150'] .wm-ermine-viewer-stage img{width:min(150%,780px)}
.wm-ermine-viewer[data-zoom='200'] .wm-ermine-viewer-stage img{width:min(200%,1040px)}
.wm-ermine-viewer[data-zoom='250'] .wm-ermine-viewer-stage img{width:min(250%,1300px)}
.wm-ermine-viewer-footer{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:9px;padding:10px clamp(12px,3vw,23px);background:#162230;border-top:1px solid #546272;color:#c4ced7}
.wm-ermine-zoom-tools{display:flex;align-items:center;gap:8px}
.wm-ermine-zoom-tools output{display:inline-block;min-width:48px;text-align:center;color:#fff}
.wm-ermine-viewer-footer p{margin:0;font:11px/1.4 system-ui,sans-serif;color:#c4ced7}
@media(max-width:640px){#collections .wm-ermine-alcove{grid-template-columns:1fr;gap:17px;padding:18px;margin:30px auto}#collections .wm-ermine-art-panel{max-width:280px;margin:0 auto}#collections .wm-ermine-overline{margin-bottom:.4rem}#collections .wm-ermine-actions{margin:12px 0}#collections .wm-ermine-art-copy h2{font-size:27px}.wm-ermine-viewer-footer p{flex-basis:100%;font-size:10px}.wm-ermine-viewer-stage{padding:8px}.wm-ermine-viewer-header{padding:9px 12px}}


/* WyattMail R11.8 — Talos visual inspection, responsive and keyboard accessible. */
#talos-study .wm-talos-zoom-tools{display:flex;align-items:center;justify-content:center;gap:10px;flex-wrap:wrap;padding:12px 14px 5px;background:#151f2b;color:#fff}
#talos-study .wm-talos-zoom-tools button{min-width:44px;min-height:44px;padding:8px 14px;border:1px solid #7c90a4;border-radius:3px;background:#243849;color:#fff;font:600 14px/1.2 system-ui,sans-serif;cursor:pointer}
#talos-study .wm-talos-zoom-tools button:focus-visible{outline:3px solid #b8d9f2;outline-offset:3px}
#talos-study .wm-talos-zoom-tools output{min-width:50px;text-align:center;font:600 14px/1.5 system-ui,sans-serif}
#talos-study .wm-talos-zoom-hint{margin:0;padding:5px 14px 10px;background:#151f2b;color:#e2e8f1;text-align:center;font:12px/1.5 system-ui,sans-serif}
#talos-study #talos-full{display:block;max-width:100%;height:auto}
@media(max-width:430px){#talos-study .wm-talos-zoom-tools{gap:6px;padding:7px 5px}#talos-study .wm-talos-zoom-hint{font-size:11px;padding:5px 8px}}
