/* V9 | Historical evidence as the primary slide visual.
   The existing explanatory diagrams move to an explicit teaching dialog.
   Uses the active Windows/Mac application's real CSS tokens. */
#book-reader .book-evidence-spread{
  gap:clamp(.65rem,2vw,1.65rem);min-height:0;
}
#book-reader .book-evidence-copy{
  display:flex;flex-direction:column;justify-content:center;gap:clamp(.3rem,.7vw,.65rem);
  min-width:0;
}
#book-reader .book-evidence-copy h3{
  font-family:var(--os-ui-font,"Noto Sans TC",sans-serif)!important;
  color:var(--os-ink,#263e3c)!important;font-size:clamp(1.3rem,2.55vw,2.6rem)!important;
  line-height:1.21!important;margin:.2rem 0!important;
}
#book-reader .book-evidence-takeaway{
  font-size:clamp(.86rem,1.16vw,1.16rem)!important;
  line-height:1.5!important;color:var(--os-ink,#344d53)!important;
  margin:.4rem 0!important;
}
#book-reader .book-evidence-context{
  font-size:.77rem;line-height:1.45;opacity:.75;margin:.18rem 0!important;
  color:var(--os-ink,#3a4e56);
}
#book-reader .book-evidence-demo-trigger{
  margin:.55rem 0 0;align-self:flex-start;min-height:40px;
  padding:.55rem .9rem;cursor:pointer;
  border-radius:var(--os-radius,3px)!important;
  color:var(--os-button-ink,#173d41)!important;
  background:var(--os-button,#e1e6e8)!important;
  border:1px solid var(--os-line,#789199)!important;
  font:750 .85rem/1.35 var(--os-ui-font,"Noto Sans TC",sans-serif);
  box-shadow:inset 0 1px #fff8;
}
#book-reader .book-evidence-demo-trigger:hover{filter:brightness(1.08)}
#book-reader .book-evidence-demo-trigger:focus-visible,
#book-reader .book-evidence-tabs button:focus-visible,
#book-reader .book-evidence-demo-close:focus-visible{
  outline:3px solid #ffad4a;outline-offset:3px;
}
#book-reader .book-evidence-art{
  min-width:0;min-height:0;height:100%;width:100%;display:flex;
  flex-direction:column;gap:.35rem;overflow:hidden;
  padding:clamp(.45rem,1vw,.85rem);margin:0;
  border:2px solid var(--os-line,#85989e);border-radius:var(--os-radius,5px);
  background:var(--os-window,#e6e9e7);color:var(--os-ink,#273c46);
  box-shadow:2px 3px 0 #0002;
}
#book-reader .book-evidence-visual{
  position:relative;flex:1 1 auto;min-width:0;min-height:90px;
  display:grid;place-items:center;overflow:hidden;background:#f4f3ee;
  border:1px solid var(--os-line,#97abb3);border-radius:clamp(0px,var(--os-radius,3px),9px);
}
#book-reader .book-evidence-image{
  display:block!important;width:100%;height:100%;min-height:0;
  max-width:100%;max-height:100%;object-fit:contain;
  object-position:center;filter:none!important;border:0!important;
  background:transparent!important;box-shadow:none!important;
}
#book-reader .book-evidence-kind{
  position:absolute;left:.35rem;top:.35rem;z-index:2;max-width:96%;
  background:#172d3fe3;color:#fff8e5;font:750 .61rem/1.2 "Noto Sans TC",sans-serif;
  padding:.28rem .42rem;border-radius:3px;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
#book-reader .book-evidence-caption{
  display:flex;flex-direction:column;gap:2px;flex:0 0 auto;min-height:0;
  font:500 .72rem/1.32 var(--os-ui-font,"Noto Sans TC",sans-serif);
}
#book-reader .book-evidence-caption-title{
  font-size:.78rem;color:var(--os-ink,#223d49);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
#book-reader .book-evidence-caption-note{
  font-size:.67rem;color:var(--os-ink,#263c44);opacity:.78;
  display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;
}
#book-reader .book-evidence-source{
  color:var(--os-ink,#1a496a)!important;
  font-size:.68rem;text-decoration:underline;text-decoration-thickness:1px;
  width:fit-content;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
#book-reader .book-evidence-tabs{
  flex:none;display:flex;gap:.25rem;min-width:0;overflow-x:auto;
  scrollbar-width:thin;padding:.08rem 0;
}
#book-reader .book-evidence-tabs button{
  white-space:nowrap;cursor:pointer;font-size:.66rem;line-height:1.3;
  min-height:30px;padding:.35rem .48rem;flex:0 0 auto;
  background:var(--os-button,#f5f8f7);color:var(--os-button-ink,#23465d);
  border:1px solid var(--os-line,#9cb2b1);border-radius:var(--os-radius,2px);
}
#book-reader .book-evidence-tabs button[aria-pressed=true]{
  background:var(--os-titlebar,#2e5372);color:var(--os-title-ink,#fff);
}
#book-reader .book-evidence-error{
  margin:.4rem;padding:.8rem;font:.85rem/1.45 "Noto Sans TC",sans-serif;color:#653a30;
}
#book-reader .book-evidence-visual.is-record{
  background:repeating-linear-gradient(0deg,#273e5410 0 1px,transparent 1px 28px),
             #f7f3e8;
}
#book-reader .book-evidence-record{
  min-width:0;width:min(95%,520px);max-height:100%;overflow:auto;
  margin:auto;padding:clamp(.85rem,2vw,1.7rem);
  border:1px solid #c4ae8b;border-left:5px solid #806546;
  background:#fffbf2;color:#342e29;box-shadow:4px 5px 0 #8270502b;
  text-align:left;font-family:Georgia,"Noto Serif TC",serif;
}
#book-reader .book-evidence-record-kicker{
  font:750 .68rem/1.5 ui-monospace,Consolas,monospace;
  color:#77573d;letter-spacing:.05em;
}
#book-reader .book-evidence-record-title{
  display:block;font-size:clamp(1.05rem,1.5vw,1.4rem);line-height:1.28;color:#2e332d;
  margin:.45rem 0 .65rem;
}
#book-reader .book-evidence-record-institution,
#book-reader .book-evidence-record-note{
  font:.78rem/1.48 "Noto Sans TC",sans-serif;color:#514b3a;margin:.35rem 0;
}
#book-reader .book-evidence-record-link{
  display:inline-flex;margin-top:.7rem;font:.78rem/1.45 "Noto Sans TC",sans-serif;
  color:#375b80!important;text-decoration:underline;
}
#book-reader .book-evidence-demo-dialog{
  position:fixed;inset:0;margin:auto;
  width:min(1150px,96vw);max-width:96vw;max-height:92dvh;
  padding:0;background:var(--os-window,#f4f6f8);color:var(--os-ink,#183a4b);
  border:2px solid var(--os-line,#a3b8bd);border-radius:var(--os-radius,4px);
  box-shadow:0 20px 65px #0009;overflow:hidden;
}
#book-reader .book-evidence-demo-dialog::backdrop{background:#071723c9;backdrop-filter:blur(6px)}
#book-reader .book-evidence-demo-dialog[open]{
  display:flex;flex-direction:column;z-index:300;
}
#book-reader .book-evidence-demo-header{
  display:flex;align-items:center;justify-content:space-between;gap:.5rem;flex:none;
  padding:.65rem 1rem;background:var(--os-titlebar,#2f5363);
  color:var(--os-title-ink,#fff);font:750 .88rem/1.4 var(--os-ui-font,"Noto Sans TC",sans-serif);
}
#book-reader .book-evidence-demo-header strong{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#book-reader .book-evidence-demo-close{
  flex:none;padding:.38rem .7rem;min-height:32px;cursor:pointer;
  border:1px solid var(--os-line,#acc2c0);
  background:var(--os-button,#e6e9e6);color:var(--os-button-ink,#233f43);
  border-radius:var(--os-radius,2px);font:700 .79rem "Noto Sans TC",sans-serif;
}
#book-reader .book-evidence-demo-body{
  display:block;min-height:0;overflow:auto;overscroll-behavior:contain;
  padding:clamp(.5rem,1vw,1rem);background:var(--os-client,#f9faf9);
}
#book-reader .book-evidence-demo-body > .book-spread{
  width:100%;height:auto!important;min-height:min(500px,73dvh);
  max-height:none;overflow:visible;display:grid;
  grid-template-columns:minmax(0,.43fr) minmax(0,.57fr);
  gap:1rem;
}
#book-reader .book-evidence-demo-body .book-art{
  min-height:360px;max-height:70dvh;
}
#book-reader .book-evidence-demo-body .book-original-diagram{
  display:block!important;object-fit:contain;max-width:100%;max-height:70dvh;
}
#book-reader .book-evidence-demo-body .book-atlas-spread .book-copy{
  background:var(--os-client,#f9faf9);color:var(--os-ink,#263c46);
}
#book-reader .book-evidence-demo-body .book-atlas-nav button{cursor:pointer}
#book-reader .book-evidence-demo-body .book-atlas-art{height:min(66dvh,650px)!important}
#book-reader .book-evidence-demo-body .book-atlas-art .book-atlas-standalone{
  object-fit:contain;max-height:100%;
}
#book-reader .book-evidence-demo-body .book-atlas-copy{
  min-width:0;overflow-wrap:anywhere;
}
@media(max-width:980px){
 #book-reader .book-evidence-copy h3{font-size:clamp(1.1rem,2.8vw,1.9rem)!important}
 #book-reader .book-evidence-art{min-height:0}
 #book-reader .book-evidence-demo-body > .book-spread{
  grid-template-columns:1fr;gap:.6rem;
 }
 #book-reader .book-evidence-demo-body .book-art{
  height:min(50dvh,470px)!important;min-height:220px;
 }
}
@media(max-width:650px){
 #book-reader .book-evidence-copy{gap:.2rem}
 #book-reader .book-evidence-takeaway{font-size:.86rem!important}
 #book-reader .book-evidence-demo-trigger{min-height:35px;font-size:.74rem;padding:.4rem .6rem}
 #book-reader .book-evidence-art{padding:.35rem;gap:.23rem}
 #book-reader .book-evidence-caption-title{font-size:.7rem}
 #book-reader .book-evidence-caption-note{font-size:.6rem;-webkit-line-clamp:1}
 #book-reader .book-evidence-tabs button{font-size:.59rem}
 #book-reader .book-evidence-visual{min-height:40px}
 #book-reader .book-evidence-kind{font-size:.5rem;padding:.18rem .27rem}
 #book-reader .book-evidence-record{padding:.65rem}
 #book-reader .book-evidence-record-title{font-size:.94rem}
 #book-reader .book-evidence-record-note{font-size:.7rem}
 #book-reader .book-evidence-demo-dialog{width:100vw;max-width:100vw;max-height:100dvh;height:100dvh;border:0}
 #book-reader .book-evidence-demo-body{padding:.5rem}
}
@media(max-height:500px){
 #book-reader .book-evidence-takeaway{font-size:.74rem!important;line-height:1.29!important}
 #book-reader .book-evidence-context{display:none}
 #book-reader .book-evidence-caption-note{display:none}
 #book-reader .book-evidence-caption{gap:0}
 #book-reader .book-evidence-art{padding:.25rem}
 #book-reader .book-evidence-demo-trigger{min-height:30px;padding:.2rem .4rem}
 #book-reader .book-evidence-demo-body{padding:.3rem}
}
@media(prefers-reduced-motion:reduce){
 #book-reader .book-evidence-art *{animation:none!important;transition:none!important}
}

/* Timeline folios: the chronological event list remains readable on the left;
   a sourced period photograph is already visible on the right, without
   requiring the presenter to open a collapsed <details> element first. */
@media(min-width:981px){
 #book-reader .book-leaf[data-evidence-timeline=true] .book-appendix{
  position:relative;min-height:320px;
 }
 #book-reader .book-leaf[data-evidence-timeline=true] .book-appendix>h2,
 #book-reader .book-leaf[data-evidence-timeline=true] .book-appendix>.book-appendix-lead,
 #book-reader .book-leaf[data-evidence-timeline=true] .book-events{
  width:63%;max-width:63%;
 }
 #book-reader .book-leaf[data-evidence-timeline=true] .book-timeline-feature{
  position:absolute;top:0;right:0;width:34%;height:min(100%,325px);
  box-sizing:border-box;z-index:1;
 }
 #book-reader .book-leaf[data-evidence-timeline=true] .book-timeline-feature .book-evidence-visual{
  min-height:0;
 }
 #book-reader .book-leaf[data-evidence-timeline=true] .book-timeline-feature .book-evidence-kind{
  font-size:.54rem;
 }
 #book-reader .book-leaf[data-evidence-timeline=true] .book-timeline-feature .book-evidence-caption{
  gap:1px;
 }
}
@media(max-width:980px){
 #book-reader .book-leaf[data-evidence-timeline=true] .book-appendix{
  display:flex;flex-direction:column;gap:.35rem;
 }
 #book-reader .book-leaf[data-evidence-timeline=true] .book-timeline-feature{
  order:2;max-height:250px;min-height:130px;width:100%;flex:1;
 }
 #book-reader .book-leaf[data-evidence-timeline=true] .book-events{order:3}
}
@media(max-height:550px){
 #book-reader .book-leaf[data-evidence-timeline=true] .book-timeline-feature .book-evidence-caption-note{display:none}
}

/* V9 timeline evidence compact pass: do not compress the entire event list
   to 63% width. A compact photo sits beside the headline only. */
@media(min-width:981px){
 #book-reader .book-leaf[data-evidence-timeline=true] .book-events{
  width:100%!important;max-width:100%!important;
 }
 #book-reader .book-leaf[data-evidence-timeline=true] .book-timeline-feature{
  width:33%;height:145px;max-height:145px;
 }
 #book-reader .book-leaf[data-evidence-timeline=true] .book-timeline-feature .book-evidence-caption-note{
  display:none;
 }
 #book-reader .book-leaf[data-evidence-timeline=true] .book-timeline-feature .book-evidence-kind{
  font-size:.5rem;
 }
}
@media(max-width:980px){
 #book-reader .book-leaf[data-evidence-timeline=true] .book-appendix{display:block!important}
 #book-reader .book-leaf[data-evidence-timeline=true] .book-timeline-feature{display:none!important}
 #book-reader .book-leaf[data-evidence-timeline=true] .book-events{
  width:auto!important;max-width:none!important;
 }
}


/* Keep very wide projector imagery inside the slide without triggering a
   misleading digest because its intrinsic photo is taller than the usable
   display area. Smaller layouts keep their natural height/fallback. */
@media(min-width:1500px) and (min-height:900px){
 #book-reader .book-evidence-art{max-height:650px!important}
}


/* V5's hidden source leaf must win over timeline mobile display rules.
   Otherwise the summary appears correct while a hidden event list still
   contributes scroll height in compact Mac landscape viewports. */
#book-reader .book-leaf[data-evidence-timeline=true] .book-leaf-content > .book-appendix[hidden]{
 display:none!important;
}

/* Recovery affordance is invisible during normal historical-photo viewing. */
#book-reader img[data-image-failed="true"],img[data-image-failed="true"]{
  opacity:0!important;
}
.image-recovery-panel{
  position:relative;z-index:4;
  max-width:92%;margin:.5rem auto;
  padding:.7rem .8rem;border:1px solid #bea391;border-radius:5px;
  display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:.5rem;
  background:#fffaf2;color:#6b4031;
  font:650 .76rem/1.5 "Noto Sans TC",system-ui,sans-serif;
}
.book-evidence-visual>.image-recovery-panel{
  position:absolute;left:4%;right:4%;top:50%;transform:translateY(-50%);
}
.image-recovery-button{
  cursor:pointer;min-height:33px;padding:.36rem .65rem;
  border:1px solid #96765f;border-radius:4px;
  background:#fff;color:#4b382e;
  font:700 .75rem/1.3 "Noto Sans TC",system-ui,sans-serif;
}
.image-recovery-button:hover{background:#f4e9dc;}
.image-recovery-button:focus-visible{outline:3px solid #e6a446;outline-offset:2px;}
