/* ===== instruments.css ===== */
#lab-hotspots {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.annotation-leader {
  position: absolute;
  height: 1px;
  background: #f5f5f5;
  box-shadow: 0 0 1px 1px #2e2e2e87;
  transform-origin: 0 50%;
}

.annotation-leader::before {
  position: absolute;
  content: '';
  top: -2px;
  left: -2px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #f5f5f5;
  box-shadow: 0 0 0 1px #313131ac;
}

.annotation-label {
  position: absolute;
  z-index: 1;
  pointer-events: auto;
  white-space: nowrap;
  min-height: 34px;
  padding: 5px 8px;
  border: 1px solid #dadada;
  border-radius: 7px;
  background: #f7f7f7;
  color: #3c3c3c;
  box-shadow: 0 2px 8px #21212136;
  font-size: 11px;
  font-weight: 600;
}

.annotation-label:hover { background: #efefef; border-color: #bbbbbb; }
.annotation-label[aria-pressed=true] { background: var(--action); color: white; border-color: var(--action-border); }
.annotation:has(.annotation-label[aria-pressed=true]) .annotation-leader,
.annotation:has(.annotation-label[aria-pressed=true]) .annotation-leader::before { background: #cfcfcf; }

#instrument-entrance {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
}

.instrument-heading .instrument-actions { flex-shrink: 0; }
#open-photo-focus {
  color: var(--action);
  background: var(--action-soft);
  border-color: var(--action-border);
  font-weight: 600;
}
#open-photo-focus:hover { color: white; background: var(--action); border-color: var(--action); }

#photo-focus-dialog {
  width: min(1200px, calc(100vw - 28px));
  height: calc(100dvh - 30px);
  max-width: none;
  max-height: none;
  padding: 14px;
  background: white;
  border-radius: 14px;
}
#photo-focus-dialog[open] { display: flex; flex-direction: column; gap: 10px; }
#photo-focus-dialog .dialog-header { align-items: center; }
#photo-focus-title { font-size: clamp(13px, 2vw, 18px); margin: 0; line-height: 1.5; }
#photo-focus-content { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
#photo-focus-content #image-viewport { flex: 1; box-shadow: none; min-height: 84px; }
#photo-focus-content .instrument-controls { flex-shrink: 0; }
.photo-focus-footer { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-shrink: 0; }
.photo-focus-footer button { min-height: 32px; padding: 5px 8px; font-size: 11px; }
.photo-focus-footer button[aria-pressed=true] { color: var(--action); border-color: var(--action-border); background: var(--action-soft); }
#photo-focus-source { font-size: 11px; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 760px) {
  #photo-focus-dialog { width: 100%; height: 100dvh; margin: 0; padding: 10px; border: 0; border-radius: 0; }
  #photo-focus-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  #photo-focus-content #image-viewport { margin-inline: -10px; border-radius: 0; border-inline: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  [data-entrance] #lab-hotspots { animation: annotations-in .52s ease both; }
  [data-entrance=slab] #lab-photo { animation: reveal-cut .44s cubic-bezier(.25,.6,.35,1) both; }
  [data-entrance=slab] #instrument-entrance {
    background: linear-gradient(96deg, transparent 0 42%, #c9c9c957 48%, #f4f4f4c2 50%, transparent 53%);
    background-size: 42% 100%;
    background-repeat: no-repeat;
    animation: cut-light .46s ease-out;
  }

  [data-entrance=thin] #lab-photo { animation: mount-slide .46s cubic-bezier(.2,.65,.28,1) both; }
  [data-entrance=thin] #instrument-entrance {
    background: radial-gradient(circle, transparent 0 43%, #e8e8e863 44%, #e8e8e80e 45%, transparent 46%);
    animation: lens-ring .48s ease-out;
  }

  [data-entrance=sem] #lab-photo { animation: reveal-scan .48s ease-out both; }
  [data-entrance=sem] #instrument-entrance {
    background:
      linear-gradient(180deg, transparent 32%, #dcdcdc5e 47%, #f9f9f9 50%, transparent 57%) no-repeat,
      repeating-linear-gradient(0deg, #dadada26 0 1px, transparent 1px 6px);
    background-size: 100% 22%, 100% 100%;
    animation: scan-light .5s linear;
  }
}

@keyframes annotations-in {
  0%, 63% { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes reveal-cut {
  from { clip-path: inset(0 100% 0 0); opacity: .35; }
  to { clip-path: inset(0); opacity: 1; }
}
@keyframes cut-light {
  0% { background-position: -40% 0; opacity: 0; }
  23% { opacity: .78; }
  80% { opacity: .55; }
  100% { background-position: 135% 0; opacity: 0; }
}
@keyframes mount-slide {
  from { transform: translateY(13%) scale(.91); opacity: .14; }
  to { transform: none; opacity: 1; }
}
@keyframes lens-ring {
  0% { transform: scale(1.14); opacity: .08; }
  45% { opacity: .7; }
  100% { transform: scale(.9); opacity: 0; }
}
@keyframes reveal-scan {
  from { clip-path: inset(0 0 100% 0); opacity: .5; }
  to { clip-path: inset(0); opacity: 1; }
}
@keyframes scan-light {
  0% { background-position: 0 -20%, 0 0; opacity: 0; }
  17% { opacity: .8; }
  84% { opacity: .74; }
  100% { background-position: 0 125%, 0 0; opacity: 0; }
}

/* ===== collection.css ===== */
/* The workbench shares the quiet paper and rules of the specimen catalogue. */
:root { --sheet:var(--site-bg,#f6f5f0); --rule:var(--site-border,#c8c7bd); --label:var(--site-muted,#5b5b53); --action:var(--site-accent,#903925); }
body { background:var(--sheet); color:var(--site-fg,#24241f); font-family:var(--site-font,"Segoe UI","Microsoft YaHei",sans-serif); }
header { background:#faf9f5; border-color:var(--rule); }
.brand { gap:12px; font-weight:700; min-width:0; }
.cdut-emblem { display:block; flex:none; width:36px; height:36px; object-fit:contain; border-radius:50%; }
.brand-name { min-width:0; white-space:normal; line-height:1.3; }
.catalog-trigger,.notebook-trigger,.sample-picker select,.view-controls button { border-radius:var(--site-radius,5px); }
.sample-picker {
  position:relative; width:clamp(248px,25vw,360px); max-width:100%;
  --action-width:72px; --picker-height:44px;
}
.sample-picker .picker-action {
  position:absolute; z-index:1; inset:1px auto 1px 1px; width:var(--action-width);
  display:grid; place-items:center; pointer-events:none; border-radius:4px 0 0 4px;
  background:var(--action); color:white; font-size:15px; font-weight:700;
}
.sample-picker select {
  width:100%; max-width:none; min-width:0; height:var(--picker-height);
  padding:0 36px 0 calc(var(--action-width) + 14px);
  -webkit-appearance:none; -moz-appearance:none; appearance:none; cursor:pointer;
  background-color:#fffefa;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238C3B27' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 14px center; background-size:10px 6px;
  color:#28251f; border:1px solid var(--action);
  font-size:15px; font-weight:600; line-height:calc(var(--picker-height) - 2px); text-overflow:ellipsis;
}
.sample-picker select::-ms-expand { display:none; }
.sample-picker:hover select { background-color:#faf1ec; }
.sample-picker select:focus-visible { outline:2px solid var(--action); outline-offset:3px; }
@media (forced-colors:active) {
  .sample-picker select { appearance:auto; -webkit-appearance:auto; -moz-appearance:auto; background-image:none; }
}
.bench { background:var(--sheet); }
.bench-heading .eyebrow, aside>.eyebrow,.section-no { color:var(--action); font-weight:650; }
.bench-heading h1 { font-weight:600; letter-spacing:0; }
#viewport { background:#eeeee8; border-block:1px solid var(--rule); }
#viewport::before { display:none; }
#loading {
  z-index:2; top:50%; left:50%; transform:translate(-50%,-50%);
  width:max-content; max-width:90%; margin:0; padding:12px 18px;
  border-radius:5px; background:#faf9f5; color:#282921;
  line-height:1.6; pointer-events:none;
}
#loading small { display:block; margin-top:3px; font-size:12px; color:#505349; }
#viewport.model-fallback canvas { display:none; }
#viewport.model-fallback img { width:100%; height:100%; object-fit:contain; }
#viewport.scan-stage { background:radial-gradient(ellipse at 48% 38%,#838780 0%,#646962 52%,#454a45 100%); }
#viewport.studio-backdrop canvas { clip-path:none; }
.view-label { font-variant-numeric:tabular-nums; }
.insight #tool-description,.reference small,footer,footer a,.small,#open-sample-info { color:#57584f; }
.bench-heading .intro { color:#56584f; }
.tools { border-radius:8px; border:1px solid var(--rule); background:#fbfaf7; box-shadow:none; }
.tool { border-radius:4px; background:transparent; }
.tool.active,.tool.active:hover { color:var(--site-on-accent,white); background:var(--action); border-color:var(--action); }
.tool.active .tool-icon,.tool.active[data-recorded=true]::after { color:white; }
aside { background:var(--site-surface,#fffefa); border-color:var(--rule); }
aside h2,.dialog-header h2,.catalog-card h3 { font-family:"STSong","SimSun",serif; color:#26251e; font-weight:650; }
.insight { box-shadow:none; background:transparent; border:0; border-block:1px solid var(--rule); border-radius:0; }
.insight-tabs { border-radius:0; border-bottom:1px solid var(--rule); background:transparent; padding:0; gap:0; }
.insight-tabs button { border-radius:0; }
.insight-tabs [aria-selected=true] { color:var(--action); background:transparent; box-shadow:inset 0 -2px var(--action); }
.reference img,.image-viewport,.preparation,dialog { border-radius:6px; }
.image-viewport { box-shadow:none; }
#slice-controls:not([hidden]) { flex-shrink:0; display:grid; grid-template-columns:auto minmax(70px,1fr) auto; align-items:center; gap:14px; padding:9px 12px; border-block:1px solid var(--rule); background:#fbfaf7; }
#slice-controls label { color:#34342d; font-size:12px; }
#slice-controls output { color:var(--action); font:600 15px Consolas,monospace; }
#slice-range { accent-color:var(--action); width:100%; min-height:32px; margin:0; }
#slice-controls small { color:var(--label); font-size:11px; }
#slice-controls a { text-decoration:underline; text-underline-offset:3px; }
#catalog-dialog { background:#faf9f5; }
#stage-detail {
  display:flex; align-items:center; gap:12px; pointer-events:auto; text-align:left;
  padding:6px 12px 6px 6px; color:#faf8ed; background:#19221df2;
  border:1px solid #a3b4a775; border-radius:4px; max-width:100%;
}
#stage-detail img { width:58px; height:54px; object-fit:cover; border-radius:2px; }
#stage-detail :is(small,strong) { display:block; }
#stage-detail small { color:#c5d1c7; font-size:10px; margin-bottom:4px; }
#stage-detail strong { font-size:14px; font-weight:600; }
#stage-detail b { margin-left:auto; font-weight:400; }
#orbit-tour { font-weight:650; border-color:var(--action); color:var(--action); }
#orbit-tour[aria-pressed=true] { background:var(--action); color:white; }
.exhibit #viewport.studio-backdrop {
  background:radial-gradient(ellipse at 62% 43%,#637468 0%,#374b40 45%,#17271f 100%);
}


#catalog-grid { gap:calc(14px * var(--site-space,1)); }
.catalog-card { padding:0 0 12px; border:0; border-bottom:1px solid var(--rule); border-radius:0; background:transparent; }
.catalog-card img { border:0; border-radius:3px; background:#e8e7df; height:155px; margin:0 0 10px; }
.catalog-card :is(h3,p,small,b,.catalog-meta) { margin-inline:8px; }
.catalog-card[aria-current] { box-shadow:inset 0 -2px var(--action); }
.catalog-card small,.catalog-card b { color:var(--action); }
.catalog-card h3 { font-size:21px; }
.catalog-card.catalog-plate {
  position:relative; isolation:isolate; overflow:hidden; display:block;
  background:#29352e; border:0; border-radius:3px; padding:0; min-height:205px;
}
.catalog-plate img { position:absolute; z-index:-2; inset:0; width:100%; height:100%; object-fit:cover; margin:0; }
.catalog-plate::after {
  content:""; position:absolute; z-index:-1; inset:0;
  background:linear-gradient(0deg,#101a16ee 0%,#101a16b8 27%,transparent 69%);
}
.catalog-plate .plate-label { position:absolute; inset:auto 20px 16px; color:white; }
.catalog-plate .plate-label :is(small,h3,b) { display:block; margin:0; color:inherit; }
.catalog-plate .plate-label small { font:11px/1.4 Consolas,"Microsoft YaHei",sans-serif; }
.catalog-plate .plate-label h3 { text-wrap:balance; font-size:clamp(21px,2.1vw,32px); margin:4px 0; }
.catalog-plate .plate-label b { font-size:11px; font-weight:500; }
.catalog-plate[aria-current] { box-shadow:inset 0 -3px #d5a782; }
@media(min-width:761px){
  #catalog-dialog { width:min(990px,94vw); padding:28px; }
  #catalog-title { font-size:36px; letter-spacing:.04em; }
  #catalog-grid { grid-template-columns:repeat(4,minmax(0,1fr)); gap:calc(12px * var(--site-space,1)); }
  .catalog-plate { grid-column:span 2; }
  #catalog-grid:is(:not([data-category]),[data-category=all],[data-category=scan]) .catalog-plate:first-child { grid-row:span 2; }
  .catalog-plate:first-child .plate-label h3 { font-size:38px; }
}
@media(min-width:1101px){
  .exhibit:not(.experiment-active) #viewport { inset:18px 18px 139px; border:0; }
  .exhibit:not(.experiment-active) .bench-heading {
    inset:52px auto 169px 48px; width:29%; z-index:2;
    display:flex; flex-direction:column; align-items:flex-start;
  }
  .exhibit:not(.experiment-active) .bench-heading .eyebrow { color:#eef3eb; border-top:2px solid #eeeadd; padding-top:12px; margin-bottom:16px; }
  .exhibit:not(.experiment-active) .bench-heading h1 {
    color:#fffdf3; font-size:calc(clamp(43px,4.7vw,77px) * var(--site-type,1)); line-height:1.13; letter-spacing:.025em; text-wrap:balance;
  }
  .exhibit:not(.experiment-active) .bench-heading .intro { color:#e5e8dd; margin-top:12px; font-size:12px; line-height:1.7; }
  .exhibit #stage-detail { margin-top:auto; }
  .exhibit:not(.experiment-active) .view-controls { inset:auto 30px 152px auto; z-index:2; }
  .exhibit:not(.experiment-active) .view-controls button { background:#f6f5eddc; color:#27362d; border-color:transparent; }
  .exhibit:not(.experiment-active) #orbit-tour { background:#253b31; color:#fff; border-color:#d7ded4; }
}
@media(max-width:1100px){
  #stage-detail { display:none; }
}
.catalog-filters button { border-radius:4px; }
@media (hover:hover) and (prefers-reduced-motion:no-preference) {
  .catalog-card { transition:transform .18s ease; }
  .catalog-card:hover { transform:translateY(-2px); }
}
@media(min-width:761px) {
  header { padding-inline:clamp(20px,3vw,46px); height:70px; }
  .bench { min-height:max(720px,calc(100svh - 110px)); }
  .bench-heading { top:23px; left:32px; }
  .bench-heading .eyebrow { margin-bottom:5px; }
  .bench-heading h1 { font-size:clamp(28px,3vw,45px); }
  #viewport { inset:142px 24px 149px; border-radius:4px; overflow:hidden; }
  .view-controls { right:24px; top:103px; }
  .view-label { left:32px; bottom:126px; }
  .gesture { right:26px; bottom:126px; }
  .bench:has(.studio-backdrop) :is(.view-label,.gesture,.gesture i) { color:#56594f; text-shadow:none; }
  aside { padding:30px 24px; }
  aside>.divider { display:none; }
  aside>.insight { margin-top:22px; }
  .insight { padding:10px 0 16px; }
  .tools { bottom:24px; }
  #experiment { bottom:120px; }
}
@media(max-width:760px) {
  .bench { background:#faf9f5; padding-bottom:calc(72px + env(safe-area-inset-bottom,0px)); }
  .brand { gap:7px; min-height:44px; }
  .cdut-emblem { width:28px; height:28px; }
  .catalog-trigger,.notebook-trigger { min-height:44px; }
  header { display:grid; grid-template-columns:minmax(0,1fr) auto auto; grid-template-rows:auto auto; height:auto; min-height:96px; gap:5px; }
  .sample-picker { grid-column:1/-1; grid-row:2; width:100%; min-width:0; --action-width:58px; --picker-height:36px; }
  .sample-picker .picker-action,.sample-picker select { font-size:13px; }
  .notebook-trigger,.catalog-trigger { margin:0; }
  .insight-tabs button { min-height:44px; }
  .view-controls { gap:3px; }
  .view-controls button { padding:5px 7px; min-height:38px; }
  #viewport { margin:0; width:100%; border-radius:4px; overflow:hidden; }
  .tools { border-radius:5px; padding:3px; }
  .tool { background:transparent; }
  .insight { padding:5px 3px 7px; }
  #slice-controls:not([hidden]) { gap:2px 12px; padding:2px 8px; }
  #slice-controls small { grid-column:1/-1; font-size:10px; }
  .catalog-card img { height:105px; }
  .catalog-card h3 { font-size:16px; }
  .catalog-filters { gap:5px; }
  .catalog-filters button { padding:6px 10px; }
  .catalog-card.catalog-plate { min-height:150px; }
  .catalog-plate:first-child { grid-column:1/-1; min-height:180px; }
  .catalog-plate .plate-label { inset:auto 10px 10px; }
  .catalog-plate .plate-label h3 { font-size:20px; }
  .catalog-plate:first-child .plate-label h3 { font-size:29px; }
  .catalog-card.catalog-plate img { height:100%; }
  .view-controls { flex-wrap:wrap; }
}

/* P1 — desktop viewport lock: header + stage + footer must fit exactly */
html { height:100%; }
body { height:100dvh; min-height:100dvh; overflow:hidden; display:flex; flex-direction:column; }
main { flex:1 1 0; min-height:0; height:auto; grid-template-rows:minmax(0,1fr); }
.bench { height:100%; min-height:0; }
main>aside { min-height:0; overflow-y:auto; overscroll-behavior:contain; }
footer { flex:0 0 auto; }
@media(max-width:760px) {
  body { height:auto; overflow:visible; }
  main { flex:1 1 auto; }
  .bench { height:auto; min-height:0; }
  main>aside { overflow:visible; }
}

/* P2 — dock #stage-detail under the title in 2D instrument modes */
.exhibit.experiment-active .bench-heading {
  inset:20px auto auto 32px; width:min(560px,44%);
  display:flex; flex-direction:column; align-items:flex-start;
}
.exhibit.experiment-active .bench-heading h1 {
  font-size:clamp(26px,2.5vw,36px); line-height:1.15;
}
.exhibit.experiment-active .bench-heading .intro {
  margin-top:6px; font-size:11.5px; line-height:1.6; max-width:52ch;
}
.exhibit.experiment-active #stage-detail {
  margin-top:10px; padding:5px 10px 5px 5px; max-width:100%;
}
.exhibit.experiment-active #stage-detail img { width:48px; height:44px; }
@media (min-width:1101px) {
  .exhibit.experiment-active:has(#stage-detail:not([hidden])) #experiment { top:196px; }
}

/* P2 — museum mat framing for 2D instruments (replaces the hard black edge) */
.experiment-active .image-viewport {
  background:#1d1b17; border:1px solid #8a7553; border-radius:5px;
  box-shadow:0 14px 34px #0000002e;
}
.experiment-active .image-viewport::after {
  content:""; position:absolute; inset:0; z-index:3; pointer-events:none;
  border:14px solid #241f19; border-radius:4px;
  box-shadow:inset 0 0 0 1px #a98d5e7a, inset 0 0 0 15px #00000055, inset 0 0 30px #00000070;
  animation:mat-in .42s ease-out both;
}
[data-mode=thin] .image-viewport {
  border:1px solid #8a7553; outline:none; border-radius:5px;
  box-shadow:0 14px 34px #0000002e;
}
[data-mode=thin] .image-viewport::after { border-color:#241f19; }
@keyframes mat-in {
  from { opacity:0; border-width:20px; }
  to { opacity:1; border-width:14px; }
}
@media (prefers-reduced-motion: reduce) {
  .experiment-active .image-viewport::after { animation:none; }
}

/* P2 — unobtrusive unlock hint for the disabled insight tabs */
.insight-lock-hint {
  margin:8px 0 0; padding-left:8px; border-left:2px solid #9a7b4f;
  color:#6b675c; font-size:11px; line-height:1.6;
}