.theme-toggle {
  min-width: 94px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  color: #f4f0e8;
  background: #ffffff0a;
  border: 1px solid #b18b5366;
  border-radius: 999px;
  font: 700 9px/1 Arial, sans-serif;
  letter-spacing: .14em;
  cursor: pointer;
  transition: color .25s ease, background .25s ease, border-color .25s ease;
}
.theme-toggle span { color: #d1b37e; font-size: 16px; line-height: 1; }
.theme-toggle:hover { color: #081720; background: #d1b37e; border-color: #d1b37e; }
.theme-toggle:hover span { color: #081720; }

img:not(.image-lightbox img) { cursor: zoom-in; }
body.lightbox-open { overflow: hidden; }
.image-lightbox {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(18px,3vw,42px);
  color: #fff;
  background: #02080ded;
  backdrop-filter: blur(18px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .24s ease, visibility .24s ease;
}
.image-lightbox.is-open { opacity: 1; visibility: visible; }
.image-lightbox figure {
  width: min(94vw,1500px);
  max-height: calc(100vh - 64px);
  margin: 0;
  display: grid;
  grid-template-rows: auto auto;
  gap: 14px;
  place-items: center;
}
.image-lightbox img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 126px);
  object-fit: contain;
}
.image-lightbox figcaption {
  width: 100%;
  color: #f4f0e8;
  font: 400 clamp(14px,1.4vw,19px)/1.35 Georgia, serif;
  text-align: center;
  letter-spacing: .025em;
}
.image-lightbox__close {
  position: absolute;
  z-index: 2;
  top: clamp(14px,2vw,28px);
  right: clamp(14px,2vw,28px);
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #081720dd;
  border: 1px solid #d1b37e99;
  border-radius: 50%;
  font: 300 30px/1 Arial, sans-serif;
  cursor: pointer;
}
.image-lightbox__close:hover { color: #081720; background: #d1b37e; }

/* The existing appearance is the default day mode. */
@media screen {
html[data-theme="night"] {
  color-scheme: dark;
  --board: #050e13;
  --ivory: #0d2029;
  --paper: #0d2029;
  --paper-2: #112831;
  --stone: #0a1c25;
  --ink: #f4efe6;
  --graphite: #f4efe6;
  --muted: #bbb8b0;
}
html[data-theme="night"],
html[data-theme="night"] body { background: #050e13; color: #f4efe6; }
html[data-theme="night"] section { box-shadow: 0 24px 65px #00000066; }
html[data-theme="night"] .object-section,
html[data-theme="night"] .space-section,
html[data-theme="night"] .version-card { color: #f4efe6; background: #0d2029; }
html[data-theme="night"] .object-copy p:not(.lead),
html[data-theme="night"] .floor-strip p,
html[data-theme="night"] .version-card p,
html[data-theme="night"] footer { color: #bbb8b0; }
html[data-theme="night"] .version-actions a { color: #f4efe6; border-color: #d1b37e55; }
html[data-theme="night"] .version-actions a:first-child { color: #081720; background: #d1b37e; }

html[data-theme="night"] .deck-shell { background: transparent; }
html[data-theme="night"] .slide { background: #0d2029; }
html[data-theme="night"] .slide.theme-dark,
html[data-theme="night"] .layout-cover .slide__inner { background: var(--navy); }
html[data-theme="night"] .slide:not(.theme-dark) { color: #f4efe6; }
html[data-theme="night"] .slide:not(.theme-dark) .title,
html[data-theme="night"] .slide:not(.theme-dark) .item__title,
html[data-theme="night"] .slide:not(.theme-dark) .role__title { color: #f4efe6; }
html[data-theme="night"] .slide:not(.theme-dark) .body,
html[data-theme="night"] .slide:not(.theme-dark) .item__desc,
html[data-theme="night"] .slide:not(.theme-dark) .role__desc,
html[data-theme="night"] .slide:not(.theme-dark) .note { color: #c9c6be; }
html[data-theme="night"] .slide:not(.theme-dark) .media-frame,
html[data-theme="night"] .slide:not(.theme-dark) .gallery__image { background: #10212a; }
}

@media print {
  .theme-toggle,
  .image-lightbox { display: none !important; }
}

@media (max-width: 820px) {
  .site-header { gap: 10px; }
  .site-header .theme-toggle { min-width: 38px; width: 38px; padding: 0; }
  .site-header .theme-toggle b { display: none; }
}

@media (max-width: 520px) {
  .deck-nav .theme-toggle { min-width: 36px; width: 36px; padding: 0; }
  .deck-nav .theme-toggle b { display: none; }
  .image-lightbox { padding: 12px; }
  .image-lightbox figure { width: 100%; height: 88vh; gap: 10px; }
  .image-lightbox__close { width: 42px; height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  .image-lightbox,
  .theme-toggle { transition: none; }
}
