/* Չկա — страница здания (стиль «светлый музей», токены — в hub.css):
   шапка, сравнение фото/рисунок, лента архива, хроника, игра, окно 3D
   и полноэкранная галерея фото (её поведение — assets/gallery.js). */

/* ================= страница здания ================= */

.s-head { padding: 6px 0 22px; }
.s-head h1 { font-size: clamp(2.625rem, calc(12vw * var(--fs)), 4.5rem); }
.s-head h1 [lang="hy"] { font-size: 0.82em; }
.s-head .meta { font-size: 1.0625rem; margin-top: 8px; }
.btn-3d { width: 100%; margin-top: 18px; }
.btn-3d .cube-i { width: 24px; height: 24px; }
.hint { margin: 10px 2px 0; color: var(--faint); font-size: 0.875rem; }

.plate {
  position: relative;
  margin: 0 0 8px;
  padding: 8px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.plate-in {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: calc(var(--r-lg) - 8px);
  background: var(--ghost-bg, #e8e4dc);
  cursor: pointer;
  touch-action: pan-y;
}
.layer, .layer picture, .layer img { position: absolute; inset: 0; width: 100%; height: 100%; }
.layer img { object-fit: cover; object-position: 50% 24%; }
.sketch { clip-path: inset(0 0 0 var(--pos, 50%)); will-change: clip-path; }
.plate:not(.dragging) .sketch { transition: clip-path 700ms cubic-bezier(0.4, 0, 0.2, 1); }
.split-line {
  position: absolute; top: 0; bottom: 0; left: var(--pos, 50%);
  width: 2px; margin-left: -1px;
  background: #fff;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}
.plate:not(.dragging) .split-line, .plate:not(.dragging) .handle { transition: left 700ms cubic-bezier(0.4, 0, 0.2, 1); }
.handle {
  position: absolute; top: 50%; left: var(--pos, 50%);
  width: 48px; height: 48px; margin: -24px 0 0 -24px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #16181b;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  cursor: ew-resize;
  touch-action: none;
  transition: transform 200ms var(--spring);
}
.plate.dragging .handle { transform: scale(1.12); }
.handle svg { width: 22px; height: 22px; }
.edge-tag {
  position: absolute; bottom: 12px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.68);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  font: 700 0.875rem/1 var(--font);
  letter-spacing: 0.02em;
  pointer-events: none;
}
.tag-l { left: 12px; }
.tag-r { right: 12px; }
.note { padding: 12px 8px 4px; }
.cred { margin: 0; color: var(--faint); font-size: 0.875rem; line-height: 1.5; }
.cred a { color: inherit; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.restore-note { margin: 8px 8px 8px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 1rem; line-height: 1.55; }
.restore-note p { margin: 0; }
.restore-note p + p { margin-top: 6px; }
.restore-note strong { color: var(--ink); }

.sec { margin-top: 56px; }

/* галерея-лента */
.gallery {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 var(--gutter);
  padding: 4px var(--gutter) 16px;
  margin: 0 calc(var(--gutter) * -1);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.gallery::-webkit-scrollbar { display: none; }
.g-item {
  flex: 0 0 auto;
  width: 148px;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  scroll-snap-align: start;
  touch-action: manipulation;
}
.g-pic {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 18px;
  background: var(--surface-2);
  box-shadow: var(--shadow);
  transition: transform 260ms var(--spring), box-shadow 260ms var(--ease);
}
.g-pic img { width: 100%; height: 100%; object-fit: cover; }
.g-item:active .g-pic { transform: scale(0.95); }
.g-item.gx-source .g-pic img { opacity: 0; }
@media (hover: hover) and (pointer: fine) {
  .g-item:hover .g-pic { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
}
.g-hint { margin: 2px 0 0; color: var(--faint); font-size: 0.875rem; }

/* хроника */
.timeline { list-style: none; margin: 0; padding: 0 0 0 26px; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px;
  border-radius: 2px; background: var(--line);
}
@media (prefers-reduced-motion: no-preference) {
  .timeline::before { transform-origin: top; transform: scaleY(0); transition: transform 900ms var(--ease) 100ms; }
  .sec.in .timeline::before { transform: scaleY(1); }
}
.timeline li { position: relative; padding: 0 0 18px; }
.timeline li > div {
  padding: 14px 16px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  margin-top: 6px;
}
.timeline li::before {
  content: ""; position: absolute; left: -26px; top: 4px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--accent);
}
.t-y { display: inline-block; font-weight: 700; font-size: 1.375rem; letter-spacing: -0.02em; color: var(--accent); line-height: 1.1; font-variant-numeric: tabular-nums; }
.timeline p { margin: 0; font-size: 1.125rem; }
.timeline > .reveal { --reveal-t: translateX(-14px); transition-delay: calc(var(--stagger, 0) * 100ms); }
.t-recon { display: inline-flex; align-items: center; gap: 10px; margin-top: 10px; padding: 4px 12px 4px 4px; border-radius: 14px; background: var(--surface-2); }
.t-recon img { width: 48px; height: 48px; object-fit: cover; border-radius: 10px; }
.t-recon-cap { font-size: 0.875rem; color: var(--muted); font-weight: 600; }

/* игра */
.quiz {
  padding: 22px 18px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.q-progress { display: flex; gap: 6px; margin-bottom: 18px; }
.q-progress span { flex: 1; height: 6px; border-radius: 6px; background: var(--surface-2); }
.q-progress span.done { background: var(--accent); }
.q-text { margin: 0 0 18px; font-size: 1.375rem; line-height: 1.3; font-weight: 700; letter-spacing: -0.015em; }
.q-options { display: grid; gap: 10px; perspective: 700px; }
.q-opt {
  position: relative;
  display: flex; align-items: center;
  width: 100%;
  min-height: 56px;
  padding: 12px 48px 12px 18px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
  color: var(--ink);
  font: 600 1.125rem/1.3 var(--font);
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 180ms var(--spring), border-color 200ms var(--ease), background 200ms var(--ease);
}
.q-opt:not([disabled]):active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .q-opt:not([disabled]):hover { border-color: var(--accent); } }
.q-opt.correct { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.q-opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.q-opt[disabled] { cursor: default; }
@media (prefers-reduced-motion: no-preference) {
  .q-opt.correct { animation: qPop 460ms var(--spring); }
  .q-opt.wrong { animation: qShake 460ms var(--ease); }
  .q-check path { animation: qDraw 360ms var(--ease) 180ms forwards; }
}
@keyframes qPop { 40% { transform: scale(1.04); } }
@keyframes qShake { 20% { transform: translateX(-6px); } 45% { transform: translateX(5px); } 70% { transform: translateX(-3px); } }
@keyframes qDraw { to { stroke-dashoffset: 0; } }
.q-check { position: absolute; right: 16px; top: 50%; width: 22px; height: 22px; margin-top: -11px; color: var(--ok); }
.q-check path { stroke-dasharray: 30; stroke-dashoffset: 30; }
@media (prefers-reduced-motion: reduce) { .q-check path { stroke-dashoffset: 0; } }
.q-result { text-align: center; }
.q-score { margin: 0 0 6px; font-size: 3.5rem; font-weight: 700; letter-spacing: -0.04em; color: var(--accent); line-height: 1; }
.q-msg { margin: 0 0 20px; font-size: 1.1875rem; }
.q-share {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 24px;
  border: 0; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font: 700 1.125rem/1 var(--font);
  cursor: pointer; touch-action: manipulation;
  transition: transform 180ms var(--spring);
}
.q-share:active { transform: scale(0.95); }
.q-share svg { width: 18px; height: 18px; }
.q-again { display: block; margin: 14px auto 0; min-height: 44px; border: 0; background: none; color: var(--muted); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.q-toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  transform: translateX(-50%) translateY(12px);
  padding: 12px 20px; border-radius: 999px;
  background: var(--ink); color: var(--bg);
  font-size: 1rem; font-weight: 600;
  opacity: 0; pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease; z-index: 90;
}
.q-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* что дальше */
.next-sec {
  margin-top: 56px;
  padding: 32px 20px;
  border-radius: var(--r-lg);
  background: var(--next-bg, var(--accent-soft));
  text-align: center;
}
.next-sec h2 { font-size: clamp(1.625rem, calc(7vw * var(--fs)), 2.25rem); margin-bottom: 10px; }
.next-sec p { margin: 0 0 20px; color: var(--muted); }
.voice-bars { display: flex; align-items: flex-end; justify-content: center; gap: 6px; height: 40px; margin-bottom: 18px; }
.voice-bars span { width: 8px; border-radius: 8px; background: var(--accent); opacity: 0.7; height: var(--h, 40%); }
@media (prefers-reduced-motion: no-preference) {
  .voice-bars span { height: 8%; transition: height 700ms var(--spring); transition-delay: calc(var(--i, 0) * 60ms); }
  .next-sec.in .voice-bars span { height: var(--h, 40%); }
}

/* окно 3D (сама сцена не менялась) */
.scene-overlay {
  position: fixed; inset: 0; z-index: 80; background: #0d1230;
  opacity: 0; transform: scale(0.96);
  transition: opacity 320ms var(--ease), transform 320ms var(--ease);
}
.scene-overlay[hidden] { display: none; }
.scene-overlay.open { opacity: 1; transform: none; }
.scene-overlay iframe { width: 100%; height: 100%; border: 0; display: block; }
.scene-close {
  position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; z-index: 2;
  width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(15, 20, 40, 0.5);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  color: #fff; display: grid; place-items: center; cursor: pointer;
}
.scene-close svg { width: 20px; height: 20px; }


/* ================= галерея (окно просмотра) ================= */

html.gx-lock, html.gx-lock body { overflow: hidden; overscroll-behavior: none; }
.gx { position: fixed; inset: 0; z-index: 70; color: var(--gx-fg); }
.gx[hidden] { display: none; }
.gx-probe { position: absolute; visibility: hidden; pointer-events: none; padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px); }
.gx-backdrop {
  position: absolute; inset: 0;
  background: var(--gx-bg);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  backdrop-filter: blur(24px) saturate(140%);
  opacity: 0;
}
.gx.gx-open .gx-backdrop { opacity: 1; transition: opacity 380ms var(--ease); }
.gx.gx-open.gx-dragging-down .gx-backdrop, .gx.gx-grabbing .gx-backdrop { transition: none; }
.gx.gx-closing .gx-backdrop { opacity: 0 !important; transition: opacity 360ms var(--ease); }
.gx-viewport { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.gx.gx-grabbing .gx-viewport { cursor: grabbing; }
.gx-track, .gx-slide { position: absolute; inset: 0; will-change: transform; }
.gx-slide { transform-origin: 50% 50%; }
.gx-zoom { position: absolute; transform-origin: 0 0; will-change: transform; }
.gx-zoom img {
  width: 100%; height: 100%; object-fit: contain;
  border-radius: var(--gx-radius);
  box-shadow: var(--gx-photo-shadow);
  background: var(--gx-photo-bg, transparent);
  -webkit-user-drag: none; user-select: none; pointer-events: none;
}
.gx.gx-zoomed .gx-zoom img { border-radius: 0; box-shadow: none; }
.gx:not(.gx-ready) .gx-slide:nth-child(2) .gx-zoom { visibility: hidden; }
.gx.gx-closing .gx-viewport { opacity: 0; transition: opacity 200ms var(--ease); }
.gx.gx-animating .gx-slide:not(:nth-child(2)) { visibility: hidden; }

.gx-ghost {
  position: fixed; z-index: 3; overflow: hidden; pointer-events: none;
  transform-origin: 50% 50%;
  will-change: transform, clip-path;
  box-shadow: var(--gx-photo-shadow);
}
.gx-ghost img { width: 100%; height: 100%; object-fit: fill; display: block; }
.gx-ghost.gx-ghost-run {
  transition: transform 440ms cubic-bezier(0.2, 0.85, 0.25, 1), clip-path 440ms cubic-bezier(0.2, 0.85, 0.25, 1), -webkit-clip-path 440ms cubic-bezier(0.2, 0.85, 0.25, 1), border-radius 440ms var(--ease);
}

/* кнопки окна */
.gx-btn {
  display: grid; place-items: center;
  width: 52px; height: 52px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--gx-btn-line);
  background: var(--gx-btn-bg);
  color: var(--gx-btn-fg);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  box-shadow: var(--gx-btn-shadow);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 200ms var(--spring), opacity 260ms var(--ease), background 200ms var(--ease);
}
.gx-btn svg { width: 22px; height: 22px; }
.gx-btn:active { transform: scale(0.86); }
@media (hover: hover) and (pointer: fine) { .gx-btn:hover { transform: scale(1.06); } .gx-btn:active { transform: scale(0.9); } }
.gx-top { position: absolute; z-index: 4; top: calc(env(safe-area-inset-top, 0px) + 10px); right: max(12px, env(safe-area-inset-right)); }
.gx-nav { position: absolute; z-index: 4; top: 50%; margin-top: -26px; }
.gx-prev { left: max(10px, env(safe-area-inset-left)); }
.gx-next { right: max(10px, env(safe-area-inset-right)); }
.gx-zoomctl { position: absolute; z-index: 4; top: calc(env(safe-area-inset-top, 0px) + 10px); left: 16px; display: none; gap: 8px; }
.gx-zoomctl .gx-btn { width: 44px; height: 44px; }
@media (hover: hover) and (pointer: fine) { .gx-zoomctl { display: flex; } .gx-nav { width: 56px; height: 56px; margin-top: -28px; } .gx-prev { left: 24px; } .gx-next { right: 24px; } }
@media (hover: none), (max-width: 699px) {
  /* на телефоне стрелки ниже центра, где их удобно достать пальцем, и не закрывают фото */
  .gx-nav { top: auto; margin-top: 0; bottom: calc(env(safe-area-inset-bottom, 0px) + 116px); width: 48px; height: 48px; }
}

/* нижняя панель */
.gx-bar {
  position: absolute; z-index: 4; left: 0; right: 0; bottom: 0;
  padding: 0 max(12px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom, 0px) + 12px) max(12px, env(safe-area-inset-left));
  pointer-events: none;
}
.gx-bar-in {
  max-width: 720px; margin: 0 auto;
  padding: 12px 16px 12px;
  border-radius: 20px;
  background: var(--gx-bar-bg);
  color: var(--gx-bar-fg);
  border: 1px solid var(--gx-btn-line);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  box-shadow: var(--gx-btn-shadow);
  pointer-events: auto;
}
.gx-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.gx-cap { margin: 0; font-weight: 700; font-size: 1.125rem; line-height: 1.3; letter-spacing: -0.01em; }
.gx-year { margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: var(--gx-year-bg, var(--accent)); color: var(--gx-year-fg, var(--accent-ink)); font-size: 0.875rem; font-weight: 700; vertical-align: 2px; }
.gx-count { flex: none; font-weight: 700; font-size: 0.875rem; color: var(--gx-bar-muted); font-variant-numeric: tabular-nums; }
.gx-credit { margin: 4px 0 0; font-size: 0.875rem; line-height: 1.45; color: var(--gx-bar-muted); }
.gx-credit a { color: inherit; text-underline-offset: 2px; }

.gx .gx-top, .gx .gx-nav, .gx .gx-zoomctl, .gx .gx-bar { opacity: 0; transition: opacity 260ms var(--ease), transform 260ms var(--ease); }
.gx.gx-ready .gx-top, .gx.gx-ready .gx-nav, .gx.gx-ready .gx-zoomctl, .gx.gx-ready .gx-bar { opacity: 1; }
.gx.gx-ready.gx-ui-hidden .gx-nav, .gx.gx-ready.gx-ui-hidden .gx-bar, .gx.gx-ready.gx-dragging-down .gx-top,
.gx.gx-ready.gx-dragging-down .gx-nav, .gx.gx-ready.gx-dragging-down .gx-bar, .gx.gx-ready.gx-dragging-down .gx-zoomctl { opacity: 0; pointer-events: none; }
.gx.gx-ready.gx-ui-hidden .gx-bar { transform: translateY(12px); }
.gx.gx-ready.gx-ui-hidden .gx-bar-in { pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .gx *, .gx { transition: none !important; animation: none !important; }
}



/* ---------- детали «светлого музея» ---------- */

.sec { margin-top: 72px; }
.btn-history { margin-top: 10px; width: 100%; }
.btn-history svg { transition: transform 200ms var(--ease); }
@media (hover: hover) and (pointer: fine) { .btn-history:hover svg { transform: translateX(3px); } }
@media (min-width: 560px) { .btn-history { width: auto; margin-left: 8px; } }
.gx-count { color: var(--accent); }
