:root {
  --paper: #f4efe6;
  --ink: #1c1916;
  --muted: #6b6158;
  --gold: #c4a35a;
  --deep: #2c2420;
  --overlay: rgba(18, 14, 12, 0.72);
  --toolbar: rgba(28, 24, 22, 0.92);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--deep);
  color: var(--paper);
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

.hidden { display: none !important; }

#bg-parallax {
  position: fixed;
  inset: -12%;
  z-index: 0;
  background: #1a1614 center / cover no-repeat;
  pointer-events: none;
  opacity: 0;
  transition: opacity .4s ease;
}
#bg-parallax.has-image { opacity: 1; }

#viewport {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
#viewport.is-dragging { cursor: grabbing; }
#viewport.locked { cursor: default; }

#viewport,
#viewport a,
#viewport img,
#viewport .gallery-cell {
  user-select: none;
  -webkit-user-select: none;
}

#viewport img {
  -webkit-user-drag: none;
  user-drag: none;
}

#tilt-layer,
#pan-layer {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
}
#tilt-layer { transform-origin: 0 0; }

#gallery {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
}

.gallery-cell {
  position: absolute;
  overflow: hidden;
  background: #111;
  border-radius: 15px;
  user-select: none;
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none;    /* Firefox */
    -ms-user-select: none;     /* Older IE/Edge */
  transition: transform .7s .5s ease-in-out;
}
.gallery-cell:hover {
	transform: scale(1.02);
	transition: transform .3s 0s ease-out;
}
.gallery-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.gallery-cell .cover {
  position: absolute;
  inset: 0;
  transition: opacity .7s ease;
}
body.mode-create .gallery-cell .cover {
  display:none;
}
body.mode-create.preview .gallery-cell .cover {
  display:block;
}
.gallery-cell.uncovered .cover,
.gallery-cell.featured .cover { opacity: 0; pointer-events: none; }
.gallery-cell.swap-pulse img {
  animation: pulseBright .8s ease-in-out infinite;
}
@keyframes pulseBright {
  50% { filter: brightness(1.45); }
}

.page-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--overlay);
  padding: 1.5rem;
}
.overlay-card {
  background: var(--paper);
  color: var(--ink);
  padding: 2.2rem 2.4rem;
  max-width: 28rem;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
}
.overlay-wide { max-width: 40rem; text-align: left; }
.overlay-card h1, .overlay-card h2 {
  font-weight: 500;
  letter-spacing: .02em;
  margin: 0 0 1rem;
}
.overlay-actions {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin-top: 1.4rem;
}
.btn-memo {
  background: var(--deep);
  color: var(--paper);
  border: 0;
  padding: .75rem 1rem;
  text-decoration: none;
  display: inline-block;
}
.btn-memo:hover { background: #3d332d; color: var(--paper); }
.btn-ghost {
  background: transparent;
  border: 1px solid #c9bfb2;
  color: var(--ink);
  padding: .65rem 1rem;
}
.overlay-card label {
  display: block;
  text-align: left;
  font-size: .9rem;
  margin: .8rem 0;
}
#panel-body label {
	display: flex;
	flex-direction: column;
	margin-bottom: 10px;
}
.overlay-card input[type="text"],
.overlay-card input[type="email"],
.overlay-card input[type="url"],
.overlay-card textarea {
  width: 100%;
  margin-top: .3rem;
  padding: .45rem .55rem;
  border: 1px solid #cfc6b8;
  background: #fff;
  color: var(--ink);
}
.form-error { color: #8a2b2b; }

#wizard {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(18,14,12,.88);
}
.wizard-inner {
  background: var(--paper);
  color: var(--ink);
  padding: 2rem;
  width: min(36rem, 92vw);
}
.source-grid, .layout-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.2rem 0;
}
.source-card, .layout-btn {
  border: 1px solid #d5cbbd;
  background: #fff;
  padding: 1.4rem 1rem;
  text-align: center;
  color: var(--ink);
  cursor: pointer;
}
.source-card i { display: block; font-size: 1.6rem; margin-bottom: .5rem; color: var(--gold); }
.source-card input { display: none; }
.source-card.disabled, .layout-btn.disabled {
  opacity: .4;
  cursor: not-allowed;
}
.layout-btn.selected {
  border-color: var(--deep);
  box-shadow: inset 0 0 0 2px var(--deep);
}
.memo-progress {
  height: 10px;
  background: #e6ddd0;
  margin: 1rem 0;
}
.memo-progress > div {
  height: 100%;
  width: 0;
  background: var(--gold);
  transition: width .2s linear;
}
.success { color: #2f5d3a; }

#editor-toolbar {
  position: fixed;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  z-index: 25;
  display: flex;
  gap: .25rem;
  background: var(--toolbar);
  padding: .35rem;
  border-radius: 4px;
}
#editor-toolbar .tool {
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--paper);
}
#editor-toolbar .tool:hover,
#editor-toolbar .tool.active { background: rgba(255,255,255,.12); color: var(--gold); }
#editor-toolbar .tool-send { color: var(--gold); }

#editor-panel {
  position: fixed;
  right: 12px;
  top: 64px;
  z-index: 26;
  width: min(22rem, 92vw);
  background: var(--paper);
  color: var(--ink);
  padding: 1rem 1.1rem 1.2rem;
  max-height: calc(100vh - 80px);
  overflow: auto;
}
.panel-close {
  float: right;
  border: 0;
  background: transparent;
  font-size: 1.1rem;
}
.scheme-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .4rem;
}
.scheme-swatch {
  height: 36px;
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
}
.scheme-swatch span { flex: 1; }
.scheme-swatch.selected { border-color: var(--ink); }
.custom-colors input { width: 100%; margin: .2rem 0; }

#preview-exit {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 50;
  background: var(--toolbar);
  padding: .4rem .6rem;
}
#preview-exit button {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.1rem;
}

#music-tab {
  position: fixed;
  right: 0;
  bottom: 18%;
  z-index: 20;
}
#music-tab-toggle {
  background: var(--toolbar);
  color: #fff;
  border: 0;
  padding: .55rem .7rem;
  border-radius: 6px 0 0 6px;
}
#music-controls {
  background: var(--toolbar);
  color: #fff;
  padding: .6rem .75rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
#music-controls button, #music-controls a {
  color: #fff;
  background: transparent;
  border: 0;
}
#music-title { text-decoration: underline; font-size: .9rem; }

.splitter {
  position: absolute;
  z-index: 4;
  background: transparent;
}
.splitter.v { width: 8px; margin-left: -4px; cursor: ew-resize; top: 0; bottom: 0; }
.splitter.h { height: 8px; margin-top: -4px; cursor: ns-resize; left: 0; right: 0; }

.public-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem 0;
  border-bottom: 1px solid #e4dcd0;
}
.public-item a { color: var(--deep); }

body.lb-disable-scrolling #viewport { pointer-events: none; }

.lightbox .lb-outerContainer {
  display: flex !important;
  flex-direction: row;
  background: #111 !important;
  max-width: 92vw;
}
.lightbox .lb-container { flex: 1 1 auto; }
.lightbox .lb-dataContainer {
	position: absolute;
	width: min(350px, 34vw) !important;
	margin: 0 !important;
	padding: 1.2rem 1rem !important;
	background: #161616c4;
	text-align: left;
	align-self: stretch;
	z-index: 10;
	top: 10px;
	left: 10px;
	border-radius: 10px;
}
.lightbox .lb-data .lb-details {
  float: none !important;
  width: 100% !important;
}
.lightbox .lb-data .lb-caption {
  font-size: 1rem !important;
  line-height: 1.45 !important;
  color: #f3eee6 !important;
  font-weight: 400 !important;
}
.lightbox .lb-data .lb-close { float: none; margin-bottom: .8rem; }

.ui-slider { margin: .8rem 0 1rem; }
.ui-widget-content { background: #e6ddd0; border: 0; }
.ui-slider .ui-slider-handle { background: var(--deep); border: 0; }

@media (max-width: 700px) {
  .lightbox .lb-outerContainer { flex-direction: column; }
  .lightbox .lb-dataContainer { width: 100% !important; }
  #editor-toolbar { left: 8px; right: 8px; transform: none; overflow-x: auto; }
}
