/* Cell99 v4 – Raum 3D prototype: the space as the inside of a dome (three.js). */
:root {
  color-scheme: dark;
  --bg: #15181d;
  --accent: #e0a800;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}

#dome {
  position: fixed;
  inset: 0;
  touch-action: none;
}

#dome canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#dome.is-pointer { cursor: pointer; }

/* The work's name is not shown – the image should carry no text association.
   It stays available to screen readers only. */
.dome-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}


.dome-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  background: var(--bg);
  opacity: 0;
  visibility: hidden;
  cursor: default;
  transition: opacity 260ms ease, visibility 0s linear 260ms;
}

body.is-fullscreen .dome-fullscreen {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.dome-loading {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, .3);
  font-size: 10px;
  letter-spacing: .32em;
  text-transform: uppercase;
  pointer-events: none;
  transition: opacity 400ms ease;
}

body.is-ready .dome-loading { opacity: 0; visibility: hidden; }


/* Flat layer for the focused cell (video overlays, blend). Positioned by
   raum3d.js on top of the straight focus panel, or centred in full view. */
.flat {
  position: fixed;
  z-index: 15;
  overflow: hidden;
  background: var(--bg);
  opacity: 0;
  cursor: pointer;
  transition: opacity 220ms ease;
  touch-action: pan-y;
}

.flat[hidden] { display: none; }
.flat.is-visible { opacity: 1; }
.flat.is-instant { transition: none; }
body.is-fullscreen .flat { z-index: 901; cursor: default; }

.flat__media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

/* Blend: pointer position over the image controls the second image; the
   one-second ease turns fast movement into a slow metamorphosis. */
.flat__media--blend {
  opacity: var(--blend, 0);
  transition: opacity 1s cubic-bezier(.22, .72, .18, 1);
}

.flat__video-panel {
  position: absolute;
  overflow: hidden;
  opacity: 0;
  transition: opacity 420ms ease;
}

.flat__video-panel.is-playing { opacity: 1; }

.flat__video-panel video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: var(--video-fit, fill);
}

.flat__video-panel--full { inset: 0; }
.flat__video-panel--nw { top: 0; left: 0; width: 50%; height: 50%; }
.flat__video-panel--ne { top: 0; right: 0; width: 50%; height: 50%; }
.flat__video-panel--sw { bottom: 0; left: 0; width: 50%; height: 50%; }
.flat__video-panel--se { bottom: 0; right: 0; width: 50%; height: 50%; }
.flat__video-panel--left-half { top: 0; bottom: 0; left: 0; width: 50%; }
.flat__video-panel--right-half { top: 0; bottom: 0; right: 0; width: 50%; }
.flat__video-panel--right-portrait { top: 0; right: 0; width: 42.1875%; height: 100%; }

/* Placing a Zeit image: a small bar with the image and a cancel button. */
.place-bar {
  position: fixed;
  top: max(2.4vh, env(safe-area-inset-top));
  left: 50%;
  z-index: 960;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 8px 6px 6px;
  border-radius: 6px;
  color: rgba(255, 255, 255, .8);
  background: rgba(21, 24, 29, .9);
  box-shadow: 0 12px 36px rgba(0, 0, 0, .45);
  font-size: 11px;
  font-weight: 300;
  letter-spacing: .24em;
  text-transform: uppercase;
  transform: translateX(-50%);
}

.place-bar[hidden] { display: none; }
.place-bar img { width: 34px; height: 42px; object-fit: cover; outline: 1px solid var(--accent); outline-offset: 2px; }
.place-bar.is-busy { opacity: .6; pointer-events: none; }

.place-bar__cancel {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: rgba(255, 255, 255, .6);
  font-size: 14px;
  text-decoration: none;
}

.place-bar__cancel:hover { color: var(--accent); }
body.is-placing .flat { pointer-events: none; }

/* "+" for the signed-in artist: add an image straight into the Raum. */
.add-button {
  position: fixed;
  top: max(2.4vh, env(safe-area-inset-top));
  right: max(2.4vw, env(safe-area-inset-right));
  z-index: 950;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(224, 168, 0, .55);
  border-radius: 50%;
  color: var(--accent);
  background: rgba(21, 24, 29, .72);
  font: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.add-button[hidden] { display: none; }
.add-button:hover,
.add-button:focus-visible { color: var(--bg); background: var(--accent); }

/* Overview zoom in the placing bar. */
.place-bar__zoom {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, .12);
  color: rgba(255, 255, 255, .5);
}

.place-bar__zoom button {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(224, 168, 0, .5);
  border-radius: 50%;
  color: var(--accent);
  background: transparent;
  font: inherit;
  font-size: 15px;
  letter-spacing: 0;
  cursor: pointer;
}

.place-bar__zoom button:hover { color: var(--bg); background: var(--accent); }

/* Zoom for everyone: quiet −/+ bottom right. */
.view-zoom {
  position: fixed;
  right: max(2.4vw, env(safe-area-inset-right));
  bottom: max(2.4vh, env(safe-area-inset-bottom));
  z-index: 940;
  display: flex;
  gap: 6px;
  transition: opacity 260ms ease;
}

.view-zoom button {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 50%;
  color: rgba(255, 255, 255, .5);
  background: rgba(21, 24, 29, .55);
  font: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
}

.view-zoom button:hover,
.view-zoom button:focus-visible { color: var(--accent); border-color: rgba(224, 168, 0, .6); }
body.is-fullscreen .view-zoom { opacity: 0; pointer-events: none; }

/* Moving a cell: a small preview follows the pointer. */
.drag-preview {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 970;
  width: 64px;
  max-height: 80px;
  object-fit: contain;
  opacity: .9;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .55);
  pointer-events: none;
}

.drag-preview[hidden] { display: none; }
.drag-preview.is-busy { opacity: .4; }
body.is-dragging #dome { cursor: grabbing; }

/* Editing the cell in focus (signed-in artist only): a pen button next to
   "+" opens a small panel. It follows the focus while it is open. */
.cell-button { right: calc(max(2.4vw, env(safe-area-inset-right)) + 48px); display: grid; place-items: center; }
.cell-button svg { width: 17px; height: 17px; fill: currentColor; }
.cell-button[aria-expanded="true"] { color: var(--bg); background: var(--accent); }
.cell-button[hidden] { display: none; }
body.is-placing .cell-button,
body.is-fullscreen .cell-button,
body.is-fullscreen .add-button { display: none; }

.cell-panel {
  position: fixed;
  top: calc(max(2.4vh, env(safe-area-inset-top)) + 52px);
  right: max(2.4vw, env(safe-area-inset-right));
  z-index: 955;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 300px;
  max-height: calc(100vh - max(2.4vh, env(safe-area-inset-top)) - 52px - 70px);
  max-height: calc(100dvh - max(2.4vh, env(safe-area-inset-top)) - 52px - 70px);
  overflow-y: auto;
  padding: 14px;
  border-radius: 6px;
  color: rgba(255, 255, 255, .82);
  background: rgba(21, 24, 29, .94);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .5);
  font-size: 12px;
  font-weight: 300;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  overscroll-behavior: contain;
}

.cell-panel[hidden] { display: none; }
.cell-panel.is-busy { opacity: .65; pointer-events: none; }
body.is-placing .cell-panel,
body.is-fullscreen .cell-panel { display: none; }

.cell-panel__head { display: flex; align-items: center; gap: 12px; }
.cell-panel__head img { width: 44px; height: 44px; object-fit: cover; border-radius: 2px; background: rgba(255, 255, 255, .06); }
.cell-panel__head div { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 2px; }
.cell-panel__head strong { overflow: hidden; font-weight: 400; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }

.cell-panel__eyebrow,
.cell-panel__title,
.cell-panel label > span {
  color: rgba(255, 255, 255, .45);
  font-size: 10px;
  letter-spacing: .24em;
  text-transform: uppercase;
}

.cell-panel__title em { font-style: normal; letter-spacing: .1em; }

.cell-panel__close {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  color: rgba(255, 255, 255, .55);
  background: transparent;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.cell-panel__close:hover { color: var(--accent); }

.cell-panel__group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.cell-panel label { display: flex; flex-direction: column; gap: 4px; }
.cell-panel label.cell-panel__check { flex-direction: row; align-items: center; gap: 8px; }
.cell-panel label.cell-panel__check span { color: rgba(255, 255, 255, .7); font-size: 12px; letter-spacing: 0; text-transform: none; }

.cell-panel input:not([type="checkbox"]),
.cell-panel select {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 4px;
  color: #fff;
  background: rgba(255, 255, 255, .04);
  font: inherit;
  font-size: 13px;
  color-scheme: dark;
}

.cell-panel input:focus,
.cell-panel select:focus { outline: none; border-color: rgba(224, 168, 0, .7); }
.cell-panel input[type="checkbox"] { accent-color: var(--accent); }

.cell-panel__actions { display: flex; flex-wrap: wrap; gap: 8px; }

.cell-panel button:not(.cell-panel__close) {
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 4px;
  color: rgba(255, 255, 255, .8);
  background: transparent;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.cell-panel button:not(.cell-panel__close):hover:not(:disabled) { color: var(--accent); border-color: rgba(224, 168, 0, .6); }
.cell-panel button.is-primary { margin-left: auto; color: var(--accent); border-color: rgba(224, 168, 0, .55); }
.cell-panel button.is-primary:hover { color: var(--bg) !important; background: var(--accent); }
.cell-panel button.is-danger { color: #e07a6a; border-color: rgba(224, 122, 106, .4); }
.cell-panel button.is-danger:hover:not(:disabled) { color: #fff !important; background: #b8493a; border-color: #b8493a !important; }
.cell-panel button:disabled { opacity: .35; cursor: default; }

.cell-panel__hint { margin: 0; color: rgba(255, 255, 255, .45); font-size: 11px; line-height: 1.45; }
.cell-panel__hint:empty,
.cell-panel__message:empty { display: none; }
.cell-panel__message { margin: 0; color: var(--accent); font-size: 12px; line-height: 1.45; }
.cell-panel__message.is-error { color: #e07a6a; }

.cell-panel__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.cell-panel__foot a { color: rgba(255, 255, 255, .45); font-size: 11px; text-decoration: none; }
.cell-panel__foot a:hover { color: var(--accent); }
.cell-panel__foot form { margin: 0; }
.cell-panel__foot button { padding: 5px 10px !important; font-size: 11px !important; }

@media (max-width: 520px) {
  .cell-panel { left: 16px; right: 16px; width: auto; }
}

/* Loupe in the full view (images marked "Lupe"): round, full resolution. */
.loupe {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 905;
  width: clamp(170px, 30vmin, 380px);
  height: clamp(170px, 30vmin, 380px);
  border-radius: 50%;
  background-color: var(--bg);
  background-repeat: no-repeat;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .55), 0 18px 48px rgba(0, 0, 0, .55);
  pointer-events: none;
  will-change: transform;
}

.loupe[hidden] { display: none; }
/* In the full view the image is large, so the loupe grows with it. */
body.is-fullscreen .loupe {
  width: clamp(220px, 45vmin, 720px);
  height: clamp(220px, 45vmin, 720px);
}
.flat.is-loupe { cursor: none; }
body.is-fullscreen .flat { -webkit-touch-callout: none; }
body.is-fullscreen .flat,
.flat.has-loupe { touch-action: none; }
