/* SAITORA image viewer: Manager gallery, lens, and the single accessible lightbox. */
.manager-gallery { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 400px); gap: clamp(20px, 3vw, 48px); align-items: start; margin-top: 40px; padding: clamp(20px, 3vw, 36px); border: 1px solid #dfdcec; border-radius: 14px; background: #f4f3fa; }
.manager-gallery h3 { margin: 0 0 8px; }
.manager-gallery-copy > p { color: #536078; font-size: 15px; line-height: 1.7; margin: 0; }
.gallery-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 18px 0; }
.gallery-tabs button { min-height: 44px; border-radius: 8px; border: 1px solid #dfdcec; background: #fff; color: #0b1730; cursor: pointer; text-align: left; padding: 8px 12px; font: inherit; font-size: 14px; }
.gallery-tabs button[aria-pressed="true"] { border-color: #5d36ff; box-shadow: inset 0 0 0 1px #5d36ff; }
.gallery-desc { font-size: 14px; color: #536078; min-height: 3em; margin: 0; }
.gallery-legal { font-size: 12px; color: #536078; margin: 16px 0 0; }
.gallery-stage { position: relative; max-width: 360px; margin-inline: auto; }
.gallery-frame { position: relative; margin: 0; background: #0b0b0c; border-radius: 26px; padding: 8px; border: 1px solid #2a2a2e; box-shadow: 0 30px 70px #0b173033; transform: perspective(900px) rotateX(var(--fx-rx, 0deg)) rotateY(var(--fx-ry, 0deg)) scale(1); transition: transform 260ms cubic-bezier(.2,.7,.2,1); overflow: hidden; }
.gallery-frame.is-fx:not([data-lens-active]) { transform: perspective(900px) rotateX(var(--fx-rx, 0deg)) rotateY(var(--fx-ry, 0deg)) scale(1.02); }
.gallery-frame[data-lens-active] { transform: none !important; }
.gallery-frame img { display: block; width: 100%; height: auto; aspect-ratio: 1179 / 2406; object-fit: contain; border-radius: 20px; }
.lens { position: absolute; width: 160px; height: 160px; border-radius: 50%; pointer-events: none; border: 2px solid #ffffffcc; box-shadow: 0 10px 30px #00000066, inset 0 0 0 1px #00000055; background-repeat: no-repeat; z-index: 3; }
.gallery-actions { display: flex; gap: 10px; margin-top: 14px; justify-content: center; align-items: center; }
.gallery-icon-button { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid #dfdcec; background: #fff; color: #0b1730; cursor: pointer; font: inherit; font-size: 20px; }
.gallery-icon-button:hover { border-color: #5d36ff; color: #5d36ff; }
.gallery-expand { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border-radius: 8px; border: 1px solid #dfdcec; background: #fff; color: #0b1730; cursor: pointer; font: inherit; font-weight: 600; font-size: 14px; }
.gallery-expand:hover { border-color: #5d36ff; color: #5d36ff; }
/* no-JS: the four screens are a plain list; JS hides the list and drives the stage */
.gallery-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin: 20px 0 0; padding: 0; list-style: none; }
.gallery-list figure { margin: 0; }
.gallery-list img { display: block; width: 100%; height: auto; border-radius: 14px; background: #0b0b0c; }
.gallery-list figcaption { font-size: 13px; color: #536078; margin-top: 8px; }
.js-enabled .manager-gallery.is-ready .gallery-list { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.js-enabled .manager-gallery:not(.is-ready) .gallery-stage, .js-enabled .manager-gallery:not(.is-ready) .gallery-actions, .js-enabled .manager-gallery:not(.is-ready) .gallery-tabs, html:not(.js-enabled) .gallery-stage, html:not(.js-enabled) .gallery-actions, html:not(.js-enabled) .gallery-tabs, html:not(.js-enabled) .gallery-desc { display: none; }
/* lightbox */
.saitora-viewer { position: fixed; inset: 0; z-index: 1000; display: grid; grid-template-rows: auto 1fr; }
.saitora-viewer[hidden] { display: none; }
body.viewer-open { overflow: hidden; }
.viewer-backdrop { position: absolute; inset: 0; background: #061225ee; }
.viewer-bar { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px clamp(16px, 4vw, 40px); color: #fff; background: #0b1730; border-bottom: 1px solid #26395f; }
.viewer-bar h2 { font-size: 16px; margin: 0; margin-right: auto; font-weight: 600; letter-spacing: 0; }
.viewer-bar .viewer-zoom { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.viewer-bar button { min-height: 44px; min-width: 44px; padding: 6px 12px; border-radius: 8px; border: 1px solid #26395f; background: transparent; color: #fff; cursor: pointer; font: inherit; font-size: 14px; }
.viewer-bar button[aria-pressed="true"] { background: #fff; color: #0b1730; }
.viewer-bar button:focus-visible { outline: 3px solid #7ee8ff; outline-offset: 2px; }
.viewer-region { position: relative; z-index: 1; overflow: auto; padding: 24px clamp(16px, 4vw, 40px); display: grid; justify-items: center; align-content: start; }
.viewer-region:focus-visible { outline: 3px solid #7ee8ff; outline-offset: -3px; }
.viewer-region img { width: 100%; max-width: 900px; height: auto; border-radius: 12px; transition: width 200ms cubic-bezier(.2,.7,.2,1); }
.viewer-region img[data-portrait] { max-width: 520px; border-radius: 22px; }
.viewer-desc { position: relative; z-index: 1; margin: 12px 0 0; color: #c3cbe6; font-size: 14px; max-width: 900px; text-align: center; }
@media (max-width: 1080px) { .manager-gallery { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .gallery-frame, .viewer-region img { transition: none; transform: none !important; } }

/* v6: dark palette everywhere */
.manager-gallery { background: #101f3a; border-color: #26395f; }
.manager-gallery h3 { color: #fff; }
.manager-gallery-copy > p, .gallery-desc, .gallery-legal, .gallery-list figcaption { color: #b4bdda; }
.gallery-tabs button { background: #142746; color: #fff; border-color: #26395f; }
.gallery-tabs button[aria-pressed="true"] { border-color: #b9a7ff; box-shadow: inset 0 0 0 1px #b9a7ff; }
.gallery-icon-button, .gallery-expand { background: #142746; color: #fff; border-color: #26395f; }
.gallery-icon-button:hover, .gallery-expand:hover { border-color: #b9a7ff; color: #b9a7ff; }
.gallery-frame { box-shadow: 0 30px 70px #02071480; }

/* v7: no toolbar — the picture closes on click / Escape; a visually hidden close button stays for assistive tech */
.viewer-bar { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; padding: 0; border: 0; }
.saitora-viewer { grid-template-rows: 1fr; }
.viewer-region { padding: 24px clamp(16px, 4vw, 40px); align-content: center; cursor: zoom-out; }
.viewer-region img { max-width: min(92vw, 1200px); max-height: 86vh; width: auto; height: auto; object-fit: contain; cursor: zoom-out; }
.viewer-region img[data-portrait], .viewer-region img[width="590"], .viewer-region img[width="1179"] { max-width: min(92vw, 520px); }
.viewer-desc { pointer-events: none; }

/* v8: the screen switcher lives on the device — segmented pills directly above the phone, swipe on the screen, dots + caption below */
.manager-gallery { grid-template-columns: minmax(0, 1fr) minmax(300px, 460px); grid-template-areas: "copy device" "foot device"; grid-template-rows: auto 1fr; row-gap: 0; }
.manager-gallery-copy { grid-area: copy; }
.manager-gallery-device { grid-area: device; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.manager-gallery-foot { grid-area: foot; align-self: start; }
.manager-gallery-foot .gallery-legal { margin-top: 18px; }
.gallery-tabs { position: relative; display: flex; gap: 4px; margin: 0 0 14px; padding: 4px; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none; border: 1px solid #26395f; border-radius: 999px; background: #0b1730; box-shadow: inset 0 1px 0 #ffffff0d, 0 10px 30px #02071466; }
.gallery-tabs::-webkit-scrollbar { display: none; }
.gallery-tabs button { flex: 0 0 auto; scroll-snap-align: center; min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; color: #b4bdda; text-align: center; white-space: nowrap; font-size: 14px; font-weight: 600; letter-spacing: 0; box-shadow: none; transition: background-color 200ms ease, color 200ms ease, box-shadow 200ms ease; }
.gallery-tabs button:hover { color: #fff; }
.gallery-tabs button[aria-pressed="true"] { color: #fff; background: linear-gradient(135deg, #6a45ff, #8d6bff); box-shadow: 0 6px 18px #5d36ff59, inset 0 1px 0 #ffffff33; border: 0; }
.gallery-tabs button:focus-visible { outline: 2px solid #7ee8ff; outline-offset: -2px; }
.gallery-stage { width: min(100%, 360px, max(260px, calc((100vh - 240px) * 1179 / 2406))); width: min(100%, 360px, max(260px, calc((100svh - 240px) * 1179 / 2406))); max-width: none; } /* tabs + whole device fit one viewport */
.gallery-frame { touch-action: pan-y; -webkit-user-select: none; user-select: none; }
.gallery-frame img { will-change: transform, opacity; -webkit-user-drag: none; }
.gallery-dots { display: flex; justify-content: center; gap: 8px; margin: 14px 0 0; }
.gallery-dots span { width: 6px; height: 6px; border-radius: 999px; background: #3a4d75; transition: width 240ms cubic-bezier(.2,.7,.2,1), background-color 240ms ease; }
.gallery-dots span[data-active] { width: 20px; background: #b9a7ff; }
.manager-gallery-device .gallery-desc { width: min(100%, 360px); min-height: calc(1.55em * 3); margin: 10px 0 0; font-size: 13px; line-height: 1.55; text-align: center; }
.manager-gallery-device .gallery-actions { margin-top: 8px; }
html:not(.js-enabled) .gallery-dots, .js-enabled .manager-gallery:not(.is-ready) .gallery-dots { display: none; }
@media (max-width: 1080px) {
  .manager-gallery { grid-template-columns: minmax(0, 1fr); grid-template-areas: "copy" "device" "foot"; grid-template-rows: auto; }
  .manager-gallery-device { margin-top: 22px; }
}
@media (max-width: 520px) {
  .gallery-tabs { align-self: stretch; }
  .gallery-tabs button { padding: 0 14px; font-size: 13.5px; }
}
@media (prefers-reduced-motion: reduce) { .gallery-tabs button, .gallery-dots span { transition: none; } }
.gallery-tabs button:first-child { margin-left: auto; } .gallery-tabs button:last-child { margin-right: auto; } /* centred when it fits, scrollable from the start when it doesn't */
.gallery-tabs[data-more-end] { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 44px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 44px), transparent); }
.gallery-tabs[data-more-start] { -webkit-mask-image: linear-gradient(90deg, transparent, #000 44px); mask-image: linear-gradient(90deg, transparent, #000 44px); }
.gallery-tabs[data-more-start][data-more-end] { -webkit-mask-image: linear-gradient(90deg, transparent, #000 44px, #000 calc(100% - 44px), transparent); mask-image: linear-gradient(90deg, transparent, #000 44px, #000 calc(100% - 44px), transparent); }
