:root {
  color-scheme: dark;
  --bg: #101713;
  --surface: #17221d;
  --surface-strong: #202c26;
  --text: #f3efe5;
  --soft: #c9c2b2;
  --emerald: #78c7a3;
  --emerald-deep: #1f704f;
  --gold: #d5b969;
  --gold-pale: #f1dc9d;
  --berry: #86556f;
  --line: rgba(213, 185, 105, .46);
  --shadow: rgba(2, 8, 5, .62);
  --display: var(--site-font-display, 'Cormorant Garamond', Georgia, serif);
  --sans: var(--site-font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
}

:root[data-theme='dark'] { color-scheme: dark; }

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
}

button,
a { font: inherit; }

button { color: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cabinet-page {
  /* The final composite and the hotspot overlay share this single intrinsic
     1672 × 941 scene. Scaling the scene as one unit prevents the photographed
     board from drifting away from the illustrated frame or table. */
  --scene-width: max(100vw, calc(100svh * 1.776833));
  --scene-height: calc(var(--scene-width) * .562799);
  --scene-y: -50%;
  --scene-scale: 1;
  --scene-pan-x: 0px;
  --scene-pan-y: 0px;
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: 100vw;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 46%, rgba(213, 185, 105, .12), transparent 40%),
    linear-gradient(135deg, #101b16, #17131a 58%, #101b16);
}

.fantasy-surround,
.fantasy-surround::before,
.fantasy-surround::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scene-space {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  width: var(--scene-width);
  height: var(--scene-height);
  transform:
    translate(-50%, var(--scene-y))
    translate(var(--scene-pan-x), var(--scene-pan-y))
    scale(var(--scene-scale));
  transform-origin: 50% 50%;
}

.fantasy-surround {
  z-index: 1;
  overflow: hidden;
}

/* The outer camera contains the complete furniture. This inner assembly keeps
   the approved 1672 × 941 object coordinate system and its exact registration. */
.scene-content {
  position: absolute;
  width: calc(100% / 1.1398);
  height: calc(100% / 1.1217);
  left: calc(7.92% / 1.1398);
  top: calc(1.39% / 1.1217);
}

html:not(.is-portrait-browsing) .cabinet-page:not(.is-scene-interactive) {
  --scene-width: min(99.1626vw, calc((100svh - 84px) * 1.7097));
  --scene-height: calc(var(--scene-width) * 1055.5197 / 1905.7456);
  background: #172420;
}
html:not(.is-portrait-browsing) .cabinet-page:not(.is-scene-interactive) .cabinet-stage {
  height: calc(100% - 64px);
  align-self: end;
}
.cabinet-page .study-room,
.cabinet-page .study-frame-foliage {
  display: block;
  position: absolute;
  /* Register the background to the existing 1672 × 941 board coordinates.
     The outer camera fits the whole piece, including drawer, lamp and plant. */
  width: 113.98%;
  height: 112.17%;
  left: -7.92%;
  top: -1.39%;
  max-width: none;
}
.cabinet-page .surround-picture {
  position: absolute;
  inset: 0;
}
.cabinet-page .study-frame-foliage {
  /* A background-only window exposes the new timber moulding and foliage.
     The woven centre, counter and all approved object layers stay unchanged. */
  mask-image: url("assets/cabinet-frame-foliage-window-v1.svg");
  mask-size: 100% 100%;
  mask-repeat: no-repeat;
}
.cabinet-page .surround-picture img {
  /* Keep the original blue note; the new image supplies the entire recess,
     avoiding a second frame or mismatched shadow at the upper corners. */
  clip-path: url(#study-note-window);
}
.cabinet-page .fantasy-surround {
  overflow: visible;
}

.surround-picture {
  display: block;
  width: 100%;
  height: 100%;
}

.fantasy-surround img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  object-position: center;
  transform: none;
  filter: none;
  opacity: 1;
}

.fantasy-surround::before {
  content: '';
  display: none;
}

.fantasy-surround::after {
  content: '';
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.cabinet-header {
  position: fixed;
  inset: 12px 14px auto;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 12px;
  pointer-events: none;
}

.home-link,
.collection-toggle,
.title-plaque {
  pointer-events: auto;
  border: 1px solid rgba(120, 199, 163, .55);
  background: rgba(10, 18, 14, .82);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .2), inset 0 0 0 1px rgba(213, 185, 105, .14);
  backdrop-filter: blur(10px);
}

.home-link,
.collection-toggle {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 8px 15px;
  color: var(--text);
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.home-link { justify-self: start; }

.header-actions {
  display: flex;
  justify-self: end;
  gap: 8px;
  min-width: 0;
  pointer-events: auto;
}

/* The page title lives in document metadata; never restore the former plaque
   when an older HTML document meets a newer cached stylesheet. */
.title-plaque { display: none !important; }

.title-plaque {
  max-width: min(52vw, 570px);
  padding: 8px 24px 10px;
  border-color: rgba(213, 185, 105, .54);
  border-radius: 4px 4px 28px 28px;
  text-align: center;
}

.eyebrow,
.detail-kicker {
  margin: 0;
  color: var(--gold-pale);
  font-size: .7rem;
  font-weight: 750;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.title-plaque h1 {
  margin: -2px 0 0;
  font-family: var(--display);
  font-size: clamp(1.28rem, 2.4vw, 2rem);
  line-height: 1.02;
}

.cabinet-stage {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 0;
}

.cabinet-page.is-scene-interactive .cabinet-stage {
  touch-action: none;
  cursor: grab;
}

.cabinet-page.is-scene-interactive .scene-space {
  will-change: transform;
}

.cabinet-page.is-scene-dragging .cabinet-stage { cursor: grabbing; }

.cabinet-page.is-scene-interactive .cabinet-stage:focus-visible {
  outline: 2px solid var(--gold-pale);
  outline-offset: -4px;
}

.board-shell {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: 1672 / 941;
  margin: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform: none;
}

.board-plane {
  position: absolute;
  z-index: 1;
  inset: 0;
  /* Move the immutable object images and every hotspot as one assembly. */
  transform: translateY(calc(-60 / 941 * 100%));
}

.photo-object-layer {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

.recess-depth,
.object-contact-shadows {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.recess-depth { z-index: 0; }
.object-contact-shadows { z-index: 0; }

.crochet-eye {
  position: absolute;
  z-index: 1;
  display: block;
  pointer-events: none;
  width: calc(160 / 1672 * 100%);
  object-fit: fill;
}

.crochet-eye-green {
  left: calc(970 / 1672 * 100%);
  top: calc(300 / 941 * 100%);
  height: calc(150 / 941 * 100%);
}

.crochet-eye-yellow {
  left: calc(650 / 1672 * 100%);
  top: calc(600 / 941 * 100%);
  height: calc(140 / 941 * 100%);
}

.crochet-eye.is-orbiting,
.crochet-eye.is-tap-animating {
  transform-origin: 50% 50%;
  animation: crochet-orbit 2.8s ease-in-out infinite;
}

.crochet-eye-green.is-orbiting,
.crochet-eye-green.is-tap-animating {
  animation-duration: 3.2s;
  animation-direction: reverse;
}

@keyframes crochet-orbit {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(18deg); }
  46% { transform: rotate(-24deg); }
  66% { transform: rotate(10deg); }
  82% { transform: rotate(-4deg); }
  92% { transform: rotate(0deg); }
}

.chof-link {
  position: absolute;
  z-index: 3;
  left: 22.2%;
  top: 15.2%;
  isolation: isolate;
  container-type: inline-size;
  display: grid;
  place-items: center;
  width: 8.1%;
  aspect-ratio: 1;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  appearance: none;
  background: transparent;
  color: #f1dc9d;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  transform: rotate(-1.8deg);
  transform-origin: 50% 6%;
  transition: transform .2s ease, filter .2s ease;
}

.chof-link::before {
  content: '';
  z-index: 0;
  grid-area: 1 / 1;
  width: 102%;
  height: 102%;
  border-radius: 50%;
  background: repeating-conic-gradient(
    from -6deg,
    transparent 0deg 12.8deg,
    rgba(241, 220, 157, .08) 13.6deg,
    rgba(255, 239, 181, .42) 14.7deg,
    rgba(241, 220, 157, .08) 15.8deg,
    transparent 16.6deg 30deg
  );
  mask: radial-gradient(circle, transparent 0 53%, #000 61%, transparent 76%);
  opacity: .13;
  filter: blur(.5px);
  pointer-events: none;
  transform: rotate(-2deg);
  animation: chof-radiance 6.8s ease-in-out infinite;
}

.chof-link::after {
  content: '';
  z-index: 3;
  grid-area: 1 / 1;
  align-self: start;
  justify-self: center;
  width: 5.4%;
  aspect-ratio: 1;
  margin-top: 5.1%;
  border: 1px solid rgba(69, 39, 14, .72);
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #fff0ae 0 9%, #d6ad50 23%, #89531d 68%, #3e210d 100%);
  box-shadow: 0 1px .5px rgba(24, 13, 7, .76), 1px 2px 1.5px rgba(34, 19, 10, .38);
  pointer-events: none;
}

.chof-link img {
  z-index: 1;
  grid-area: 1 / 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter:
    blur(.3px)
    contrast(.94)
    saturate(.9)
    brightness(.98)
    drop-shadow(.5px 1px .75px rgba(31, 18, 10, .55))
    drop-shadow(1.5px 2.5px 1.8px rgba(42, 25, 14, .3));
}

.chof-link-label {
  z-index: 2;
  grid-area: 1 / 1;
  margin-top: 5%;
  font-family: var(--display);
  color: #e2ca91;
  /* Size the lettering against its medallion, not the phone viewport. */
  font-size: 12cqw;
  font-weight: 700;
  letter-spacing: .035em;
  line-height: 1;
  opacity: .93;
  filter: blur(.14px);
  text-shadow: 0 1px 1.3px rgba(37, 21, 15, .72);
  transform: rotate(3deg);
}

.chof-link:focus-visible {
  filter: brightness(1.03);
  animation: chof-swing 2.6s ease-in-out infinite;
}

@media (hover: hover) {
  .chof-link:hover {
    filter: brightness(1.03);
    animation: chof-swing 2.6s ease-in-out infinite;
  }
}

.chof-link.is-tap-animating { animation: chof-swing 2.6s ease-in-out 1; }
.crochet-eye.is-tap-animating { animation-iteration-count: 1; }

@keyframes chof-swing {
  0%, 100% { transform: rotate(-1.8deg); }
  22% { transform: rotate(8deg); }
  52% { transform: rotate(-8deg); }
  78% { transform: rotate(4deg); }
}

.chof-link:hover::before,
.chof-link:focus-visible::before {
  opacity: .2;
}

.chof-link:focus-visible {
  outline: 2px solid var(--gold-pale);
  outline-offset: 5px;
}

@keyframes chof-radiance {
  0%, 100% { opacity: .09; }
  48% { opacity: .17; }
  72% { opacity: .12; }
}

.hotspot-layer { position: absolute; z-index: 2; inset: 0; }

.hotspot {
  position: absolute;
  z-index: 2;
  display: block;
  min-width: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

@media (max-width: 760px), (pointer: coarse) {
  .hotspot { min-width: 24px; min-height: 24px; }
}

@media (pointer: coarse) {
  /* Keep the original art and lettering size; avoid subpixel smearing on phones. */
  .chof-link img {
    filter: contrast(.94) saturate(.9) brightness(.98)
      drop-shadow(.35px .65px .5px rgba(31, 18, 10, .5));
  }
  .chof-link-label {
    filter: none;
    opacity: 1;
    text-shadow: 0 .35px .35px rgba(37, 21, 15, .72);
  }
  .chof-link::after {
    box-sizing: border-box;
    width: clamp(3px, 5.4%, 4.5px);
    border: 0;
    box-shadow: inset 0 0 0 .35px rgba(69, 39, 14, .72),
      0 .35px .3px rgba(24, 13, 7, .7),
      .3px .6px .45px rgba(34, 19, 10, .35);
  }
  .hotspot.is-playful { min-width: 44px; min-height: 44px; }
  .chof-touch-target {
    position: absolute;
    left: 50%;
    top: 50%;
    width: max(100%, 44px);
    height: max(100%, 44px);
    transform: translate(-50%, -50%);
  }
}

.hotspot[data-shape="circle"] { border-radius: 50%; }
.hotspot[data-shape="triangle"] { clip-path: polygon(50% 0, 100% 100%, 0 100%); }

.hotspot:hover,
.hotspot:focus-visible {
  z-index: 5;
  border-color: var(--gold-pale);
  background: rgba(213, 185, 105, .1);
  box-shadow: 0 0 0 3px rgba(19, 78, 55, .76), 0 0 18px rgba(213, 185, 105, .38);
  outline: none;
}

.explore-hint {
  position: fixed;
  z-index: 20;
  left: 50%;
  top: 18px;
  bottom: auto;
  transform: translateX(-50%);
  width: max-content;
  max-width: max(180px, calc(100vw - 500px));
  margin: 0;
  padding: 5px 12px;
  border: 1px solid rgba(213, 185, 105, .28);
  border-radius: 999px;
  background: rgba(10, 18, 14, .8);
  color: var(--soft);
  font-size: .78rem;
  text-align: center;
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.scene-controls {
  position: fixed;
  z-index: 24;
  right: max(10px, env(safe-area-inset-right));
  bottom: max(9px, env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid rgba(213, 185, 105, .34);
  border-radius: 999px;
  background: rgba(10, 18, 14, .84);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .24);
  backdrop-filter: blur(8px);
}

.scene-control {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  height: 44px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.scene-control:hover,
.scene-control:focus-visible {
  border-color: rgba(213, 185, 105, .62);
  background: rgba(213, 185, 105, .12);
}

.scene-control:disabled {
  opacity: .42;
  cursor: default;
}

.scene-reset {
  min-width: 54px;
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}

.object-preview {
  position: fixed;
  z-index: 30;
  width: max-content;
  max-width: min(280px, calc(100vw - 24px));
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(12, 22, 17, .96);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .36);
  pointer-events: none;
}

.object-preview strong { display: block; }
.object-preview strong { font-family: var(--display); font-size: .96rem; line-height: 1.15; }
.object-preview span:not([hidden]) { display: block; margin-top: .3rem; font-size: .78rem; line-height: 1.35; }

.collection-panel {
  position: fixed;
  z-index: 50;
  inset: 0 0 0 auto;
  max-width: none;
  max-height: none;
  margin: 0 0 0 auto;
  width: min(430px, 100vw);
  height: 100svh;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 24px;
  border: 0;
  border-left: 1px solid var(--line);
  color: var(--text);
  background: rgba(16, 24, 20, .97);
  box-shadow: -20px 0 60px rgba(0, 0, 0, .48);
  backdrop-filter: blur(14px);
}

.collection-panel::backdrop {
  background: rgba(4, 9, 6, .58);
  backdrop-filter: blur(3px);
}

.collection-panel-head {
  position: sticky;
  z-index: 3;
  top: -24px;
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 18px;
  margin: -24px -24px 18px;
  padding: 24px;
  border-bottom: 1px solid rgba(213, 185, 105, .18);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
}

.collection-panel h2,
.detail-dialog h2 {
  margin: 2px 0 0;
  font-family: var(--display);
  font-size: clamp(1.75rem, 5vw, 2.45rem);
  line-height: 1;
}

.collection-note,
.detail-note { color: var(--soft); }
.collection-note { margin: 14px 0 18px; font-size: .87rem; }

.icon-button {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(213, 185, 105, .48);
  border-radius: 50%;
  background: var(--surface-strong);
  cursor: pointer;
  font-size: 1.6rem;
  line-height: 1;
}

.collection-group + .collection-group { margin-top: 24px; }
.collection-group h3 { margin: 0 0 9px; color: var(--gold-pale); font-family: var(--display); font-size: 1.25rem; }
.collection-list-items { display: grid; gap: 7px; }

.collection-item {
  display: block;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 9px 11px;
  border: 1px solid rgba(120, 199, 163, .22);
  border-radius: 9px;
  background: rgba(255, 255, 255, .025);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.collection-item:hover { border-color: var(--gold); background: rgba(213, 185, 105, .07); }

.detail-dialog {
  width: min(530px, calc(100vw - 28px));
  max-height: min(720px, calc(100svh - 28px));
  overflow: auto;
  padding: 31px;
  border: 1px solid rgba(213, 185, 105, .72);
  border-radius: 7px 7px 32px 32px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .62), inset 0 0 0 4px rgba(120, 199, 163, .07);
}

.detail-dialog::backdrop { background: rgba(4, 9, 6, .72); backdrop-filter: blur(5px); }
.detail-close { position: absolute; top: 15px; right: 15px; }
.detail-dialog h2 { max-width: calc(100% - 50px); margin-top: 7px; }

.dialog-ornament {
  width: 92px;
  height: 17px;
  margin-bottom: 17px;
  border-top: 1px solid var(--gold);
  border-radius: 50%;
}

.detail-facts { margin: 14px 0; }
.detail-facts div { display: grid; grid-template-columns: minmax(80px, .42fr) 1fr; gap: 14px; padding: 8px 0; border-top: 1px solid rgba(213, 185, 105, .16); }
.detail-facts dt { color: var(--soft); }
.detail-facts dd { margin: 0; font-weight: 620; }
.detail-note { margin: 15px 0 0; }

.detail-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  margin-top: 17px;
  padding: 8px 14px;
  border: 1px solid var(--emerald);
  border-radius: 999px;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.home-link:hover,
.collection-toggle:hover,
.icon-button:hover,
.detail-link:hover {
  border-color: var(--gold);
  background-color: color-mix(in srgb, var(--emerald) 16%, var(--surface-strong));
}

:focus-visible {
  outline: 3px solid var(--gold-pale);
  outline-offset: 3px;
}

[hidden] { display: none !important; }

@media (max-width: 980px) {
  .cabinet-header { grid-template-columns: auto 1fr; }
  .title-plaque { display: none; }
}

@media (pointer: coarse) and (orientation: landscape) and (max-width: 980px) {
  .cabinet-page.is-scene-interactive .explore-hint {
    top: auto;
    bottom: 2px;
    left: max(10px, env(safe-area-inset-left));
    max-width: calc(100vw - 184px - env(safe-area-inset-left) - env(safe-area-inset-right));
    transform: none;
    text-align: left;
  }
}

@media (min-aspect-ratio: 2 / 1) {
  .cabinet-page {
    /* The lowest foreground package remains visible in very shallow windows. */
    --scene-y: -50.8%;
  }
}

@media (max-width: 760px) {
  .cabinet-page {
    /* A small shared zoom keeps the objects useful on short landscape phones. */
    --scene-width: max(120vw, calc(120svh * 1.776833));
    --scene-height: calc(var(--scene-width) * .562799);
  }
  .cabinet-stage { padding: 0; }
  .explore-hint { font-size: .75rem; }
}

@media (max-width: 980px) and (orientation: portrait) {
  .cabinet-page { background: var(--bg); }
  .fantasy-surround { display: none; }

  .cabinet-stage {
    position: absolute;
    inset: 0;
    display: block;
    pointer-events: none;
  }

  .board-shell,
  .explore-hint,
  .scene-controls,
  .object-preview {
    display: none;
  }


}

@media (max-width: 420px) {
  .cabinet-header { inset: 8px; gap: 7px; }
  .home-link,
  .collection-toggle { min-height: 42px; padding: 7px 9px; font-size: .72rem; }
  .header-actions { gap: 5px; }
  .collection-panel { padding: 18px; }
  .collection-panel-head { top: -18px; margin: -18px -18px 16px; padding: 18px; }
  .detail-dialog { padding: 25px 20px; }
}

:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f2f5f2;
  --surface: #fbfcfb;
  --surface-strong: #e3eae5;
  --text: #17231d;
  --soft: #5d655f;
  --emerald: #267654;
  --emerald-deep: #174d38;
  --gold: #9c792b;
  --gold-pale: #785813;
  --line: rgba(127, 95, 25, .46);
  --shadow: rgba(36, 25, 10, .35);
}

:root[data-theme='light'] .fantasy-surround img { filter: none; opacity: 1; }
:root[data-theme='light'] .fantasy-surround::before { background: radial-gradient(ellipse at center, rgba(248, 251, 249, .1) 28%, rgba(225, 235, 229, .5) 80%); }
:root[data-theme='light'] .home-link,
:root[data-theme='light'] .collection-toggle,
:root[data-theme='light'] .title-plaque { background: rgba(248, 251, 249, .88); }
:root[data-theme='light'] .collection-panel { background: rgba(246, 249, 247, .97); }
:root[data-theme='light'] .object-preview { background: rgba(248, 251, 249, .97); }
:root[data-theme='light'] .explore-hint { background: rgba(248, 251, 249, .86); }
:root[data-theme='light'] .scene-controls { background: rgba(248, 251, 249, .9); }

@media (max-width: 760px) {
  :root[data-theme='light'] .fantasy-surround {
    background:
      radial-gradient(circle at 12% 18%, rgba(156, 121, 43, .2), transparent 24%),
      radial-gradient(circle at 88% 78%, rgba(38, 118, 84, .12), transparent 28%),
      linear-gradient(145deg, #dce7df, #f2f5f2 46%, #dce5e0);
  }
  :root[data-theme='light'] .fantasy-surround::before {
    background:
      linear-gradient(90deg, rgba(103, 75, 40, .16), transparent 30%, transparent 70%, rgba(103, 75, 40, .16)),
      radial-gradient(ellipse at center, rgba(248, 251, 249, .08), rgba(218, 229, 222, .36) 80%);
  }
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #f2f5f2;
    --surface: #fbfcfb;
    --surface-strong: #e3eae5;
    --text: #17231d;
    --soft: #5d655f;
    --emerald: #267654;
    --emerald-deep: #174d38;
    --gold: #9c792b;
    --gold-pale: #785813;
    --line: rgba(127, 95, 25, .46);
    --shadow: rgba(36, 25, 10, .35);
  }
  :root:not([data-theme]) .fantasy-surround img { filter: none; opacity: 1; }
  :root:not([data-theme]) .fantasy-surround::before { background: radial-gradient(ellipse at center, rgba(248, 251, 249, .1) 28%, rgba(225, 235, 229, .5) 80%); }
  :root:not([data-theme]) .home-link,
  :root:not([data-theme]) .collection-toggle,
  :root:not([data-theme]) .title-plaque { background: rgba(248, 251, 249, .88); }
  :root:not([data-theme]) .collection-panel { background: rgba(246, 249, 247, .97); }
  :root:not([data-theme]) .object-preview { background: rgba(248, 251, 249, .97); }
  :root:not([data-theme]) .explore-hint { background: rgba(248, 251, 249, .86); }
  :root:not([data-theme]) .scene-controls { background: rgba(248, 251, 249, .9); }
}

@media (prefers-color-scheme: light) and (max-width: 760px) {
  :root:not([data-theme]) .fantasy-surround {
    background:
      radial-gradient(circle at 12% 18%, rgba(156, 121, 43, .2), transparent 24%),
      radial-gradient(circle at 88% 78%, rgba(38, 118, 84, .12), transparent 28%),
      linear-gradient(145deg, #dce7df, #f2f5f2 46%, #dce5e0);
  }
  :root:not([data-theme]) .fantasy-surround::before {
    background:
      linear-gradient(90deg, rgba(103, 75, 40, .16), transparent 30%, transparent 70%, rgba(103, 75, 40, .16)),
      radial-gradient(ellipse at center, rgba(248, 251, 249, .08), rgba(218, 229, 222, .36) 80%);
  }
}

/* Mobile browsing uses the existing collection data and immutable scene assets. */
.portrait-collection { display: none; }
/* Open catalogue beside the complete, unchanged scene on spacious screens. */
@media (min-width: 1024px) {
  html.is-wide-browsing .cabinet-page:not(.is-scene-interactive) {
    --collection-width: clamp(280px, 24vw, 400px);
    --scene-width: min(calc(100vw - var(--collection-width) - 60px), calc((100svh - 100px) * 1905.7456 / 1055.5197));
    grid-template-columns: minmax(0, 1fr) var(--collection-width);
    grid-template-rows: minmax(0, 1fr);
    gap: 20px;
    padding: 76px 20px 20px;
    background: var(--bg);
  }
  html.is-wide-browsing .cabinet-page:not(.is-scene-interactive) .cabinet-stage {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    height: 100%;
    align-self: stretch;
  }
  .is-wide-browsing .portrait-collection {
    display: block;
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
    border-left: 1px solid var(--line);
    padding: 0 12px 24px 20px;
  }
  .is-wide-browsing .scene-space {
    top: 0;
    transform: translateX(-50%);
  }
  .is-wide-browsing .portrait-collection h1 { font-size: 1.8rem; }
  .is-wide-browsing .portrait-collection .collection-list-items { grid-template-columns: minmax(0, 1fr); }
  .is-wide-browsing .collection-item.has-thumbnail { gap: 12px; }
  .is-wide-browsing .collection-item strong { min-width: 0; overflow-wrap: anywhere; }
}
@media (min-width: 1024px) and (max-width: 1199px) {
  .is-wide-browsing .portrait-collection { padding-left: 12px; padding-right: 8px; }
  .is-wide-browsing .portrait-collection h1 { font-size: 1.6rem; }
  .is-wide-browsing .portrait-collection .collection-item { padding: 8px; font-size: .9rem; }
  .is-wide-browsing .collection-item.has-thumbnail { gap: 10px; }
}
.is-portrait-browsing,
.is-portrait-browsing body { overflow-x: hidden; overflow-y: auto; }
.is-portrait-browsing .cabinet-page {
  display: block;
  height: auto;
  min-height: 100svh;
  padding-top: 62px;
  background: var(--bg);
}
.is-portrait-browsing .cabinet-header {
  position: fixed;
  inset: 0 0 auto;
  padding: 8px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.is-portrait-browsing .cabinet-stage {
  position: relative;
  inset: auto;
  width: 100%;
  height: auto;
  aspect-ratio: 1905.7456 / 1055.5197;
  padding: 0;
  overflow: hidden;
  pointer-events: none;
}
.is-portrait-browsing .scene-space {
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  transform: none;
}
.is-portrait-browsing .fantasy-surround,
.is-portrait-browsing .board-shell { display: block; }
.is-portrait-browsing .hotspot.is-playful,
.is-portrait-browsing .chof-link { pointer-events: auto; }
.is-portrait-browsing .hotspot.is-playful { min-width: 44px; min-height: 44px; }
.is-portrait-browsing .object-preview:not([hidden]) { display: block; }
.is-portrait-browsing .portrait-collection {
  display: block;
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 18px 36px;
}
.portrait-collection h1 {
  margin: 0 0 24px;
  font-family: var(--display);
  font-size: 2rem;
  line-height: 1.1;
  scroll-margin-top: 76px;
}
.collection-map-entry { margin-bottom: 28px; }
.collection-map-cards { display: grid; gap: 7px; }
.collection-map-credit { display: inline-block; margin-top: 8px; font-size: .7rem; color: var(--soft); text-underline-offset: 3px; }
.collection-map-entry .collection-thumbnail { object-fit: contain; }
.collection-map-entry h2,
.collection-map-entry h3 {
  margin: 0 0 9px;
  color: var(--gold-pale);
  font-family: var(--display);
  font-size: 1.25rem;
  line-height: 1.2;
}
.portrait-collection .collection-item { min-height: 82px; padding: 8px 12px; }
.collection-item.has-thumbnail { display: grid; grid-template-columns: 64px 1fr; gap: 16px; align-items: center; }
.collection-thumbnail { display: block; width: 64px; height: 64px; overflow: hidden; }
.collection-product-photo { object-fit: contain; background: #fff; border-radius: 3px; }
.collection-product-frame { position: relative; flex: 0 0 64px; background: #fff; border-radius: 3px; }
.collection-product-frame .collection-product-photo { display: block; width: 64px; height: 64px; }
.collection-product-frame .is-windowed { position: absolute; left: 0; top: 0; width: 320px; height: 320px; max-width: none; border-radius: 0; transform-origin: 0 0; }
.collection-photo-credit { display: inline-block; margin-top: 24px; font-size: .75rem; color: var(--soft); text-underline-offset: 3px; }
.collection-photo-credit + .collection-photo-credit { margin-left: 16px; }
.portrait-collection .collection-item strong { font-weight: 500; }
.portrait-collection .collection-group + .collection-group { margin-top: 32px; }
@media (min-width: 600px) {
  .portrait-collection .collection-list-items { grid-template-columns: 1fr 1fr; }
}
/* A fitted stage between two compact control rails: 100% is a complete view. */
.cabinet-page.is-scene-interactive {
  --mobile-top: calc(52px + env(safe-area-inset-top));
  --mobile-bottom: calc(48px + env(safe-area-inset-bottom));
  --scene-width: min(calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right)), calc((100dvh - var(--mobile-top) - var(--mobile-bottom)) * 1905.7456 / 1055.5197));
  --scene-height: calc(var(--scene-width) * 1055.5197 / 1905.7456);
  --scene-y: -50%;
  height: 100dvh;
  background: #172420;
}
.cabinet-page.is-scene-interactive .cabinet-stage {
  display: block;
  position: absolute;
  inset: var(--mobile-top) env(safe-area-inset-right) var(--mobile-bottom) env(safe-area-inset-left);
  width: auto;
  height: auto;
  padding: 0;
  overflow: hidden;
  pointer-events: auto;
}
.is-scene-interactive .fantasy-surround,
.is-scene-interactive .board-shell { display: block; }
.is-scene-interactive .scene-space { box-shadow: none; }
.is-scene-interactive .cabinet-header {
  inset: env(safe-area-inset-top) env(safe-area-inset-right) auto env(safe-area-inset-left);
  padding: 4px 8px;
  gap: 8px;
  align-items: center;
  background: rgba(25, 19, 14, .8);
  border-bottom: 1px solid rgba(213, 185, 105, .2);
}
.is-scene-interactive .home-link,
.is-scene-interactive .collection-toggle,
.is-portrait-browsing .home-link,
.is-portrait-browsing .collection-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 5px 10px;
  font-size: .75rem;
  line-height: 1.2;
  box-shadow: none;
}
.is-scene-interactive .header-actions,
.is-portrait-browsing .header-actions { gap: 6px; }
.cabinet-page.is-scene-interactive .scene-controls {
  display: flex;
  right: max(8px, env(safe-area-inset-right));
  bottom: env(safe-area-inset-bottom);
  height: 46px;
  padding: 0;
  gap: 0;
  box-shadow: none;
}
.cabinet-page.is-scene-interactive .scene-control { height: 44px; min-width: 44px; }
.cabinet-page.is-scene-interactive .scene-reset { min-width: 52px; }
.cabinet-page.is-scene-interactive .explore-hint {
  display: block;
  left: max(8px, env(safe-area-inset-left));
  top: auto;
  bottom: calc(10px + env(safe-area-inset-bottom));
  max-width: calc(100vw - 170px - env(safe-area-inset-left) - env(safe-area-inset-right));
  transform: none;
  padding: 3px 7px;
  font-size: .68rem;
  line-height: 1.3;
  text-align: left;
}
.is-scene-interactive .object-preview:not([hidden]) { display: block; }
/* Landscape phones use the full height; controls overlay the scene.
   One shared, proportional transform keeps the picture and hotspots aligned. */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 600px) {
  .cabinet-page.is-scene-interactive {
    --mobile-top: 0px;
    --mobile-bottom: 0px;
    --scene-height: 100dvh;
    --scene-width: calc(100dvh * 1905.7456 / 1055.5197);
  }
  .is-scene-interactive .cabinet-header { background:transparent; border-bottom:0; }
}
@media (orientation: portrait) {
  .is-scene-interactive .explore-hint { visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  .chof-link:hover,
  .chof-link:focus-visible,
  .chof-link.is-tap-animating { animation: none; }
  .crochet-eye.is-orbiting,
  .crochet-eye.is-tap-animating { animation: none; }
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
