/* CLIK.ma - the photo page (photo.tpl, js/core/clik-photo.js; classes clik-ph- / js_clik-ph-): the picture on a dark stage with its
   own colours glowing around it, its tools in glass buttons, the photos before / after, the strip of its post's photos; its post beside it.
   Edge to edge (8 px from the left menu and the chat bar, 0 / the screen's width on phones), one 8 px grid. */
.clik-ph-wrap { padding: 8px; }
.clik-ph {
  display: grid; grid-template-columns: minmax(0, 1fr) clamp(340px, 28vw, 420px);
  height: calc(100vh - var(--clik-hdr-h, 56px) - 16px); min-height: 540px;
  border-radius: 12px; overflow: hidden; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 8px 24px rgba(0, 0, 0, .06);
}
body.night-mode .clik-ph { background: #242526; box-shadow: none; }

/* ---- the stage ---- */
.clik-ph-stage { position: relative; overflow: hidden; background: #0b0d12; isolation: isolate; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.clik-ph-stage.is-zoomed { touch-action: none; }
.clik-ph-amb { position: absolute; inset: -14%; z-index: 0; pointer-events: none; }
.clik-ph-amb img { width: 100%; height: 100%; object-fit: cover; filter: blur(52px) saturate(1.6) brightness(.62); opacity: 0; transition: opacity .7s ease; }
.clik-ph-stage.is-ready .clik-ph-amb img { opacity: 1; }
.clik-ph-stage.no-ambient .clik-ph-amb, .clik-ph.is-blur .clik-ph-amb { display: none; }
.clik-ph-stage::after { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, .45)); }

.clik-ph-view { position: absolute; inset: 72px 16px 16px; z-index: 1; display: flex; align-items: center; justify-content: center; }
.clik-ph-stage:has(.clik-ph-strip) .clik-ph-view { bottom: 104px; }
.clik-ph-img {
  display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain;
  border-radius: 6px; box-shadow: 0 18px 50px rgba(0, 0, 0, .5); transform-origin: center center;
  transition: transform .24s cubic-bezier(.2, .8, .3, 1), border-radius .2s; cursor: zoom-in; will-change: transform;
}
.clik-ph-stage[data-zoom=""] .clik-ph-img { cursor: default; }
.clik-ph-stage.is-zoomed .clik-ph-img { cursor: grab; border-radius: 0; }
.clik-ph-stage.is-dragging .clik-ph-img { cursor: grabbing; transition: none; }
.clik-ph.is-blur .clik-ph-img { filter: blur(28px); }

/* the logo, straight on the stage (the banner rule: its thin white edge keeps the blue letters clear) */
.clik-ph-brand { position: absolute; top: 16px; inset-inline-start: 16px; z-index: 3; pointer-events: none; }
.clik-ph-brand .clik-brand { position: static; margin: 0; }
.clik-ph-brand a, .clik-ph-brand .clik-brand * { pointer-events: auto; }

/* the tools: glass buttons, one round shape each, the icon straight in it */
.clik-ph-tools { position: absolute; top: 16px; inset-inline-end: 16px; z-index: 3; display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; max-width: calc(100% - 240px); }
.clik-ph-btn, .clik-ph-zoom, .clik-ph-chip, .clik-ph-nav, .clik-ph-strip, .clik-ph-hint, .clik-ph-veil {
  background: rgba(20, 22, 28, .55); color: #fff; border: 1px solid rgba(255, 255, 255, .16);
  -webkit-backdrop-filter: blur(12px) saturate(1.3); backdrop-filter: blur(12px) saturate(1.3);
}
.clik-ph-btn { width: 40px; height: 40px; padding: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex: none; transition: transform .15s ease, background-color .15s ease; }
.clik-ph-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; }
.clik-ph-btn:hover, .clik-ph-zoom:hover { background: rgba(255, 255, 255, .2); }
.clik-ph-btn:active { transform: scale(.9); }
.clik-ph-btn:focus-visible, .clik-ph-zoom:focus-visible, .clik-ph-nav:focus-visible, .clik-ph-th:focus-visible { outline: 2px solid #4C9AFF; outline-offset: 2px; }
.clik-ph-btn:focus:not(:focus-visible) { outline: none; }
.js_clik-ph-play .is-pause, .js_clik-ph-full .is-exit { display: none; }
.js_clik-ph-play[aria-pressed="true"] .is-play, .clik-ph-stage.is-full .js_clik-ph-full .is-enter { display: none; }
.js_clik-ph-play[aria-pressed="true"] .is-pause, .clik-ph-stage.is-full .js_clik-ph-full .is-exit { display: block; }
.js_clik-ph-play .is-play { fill: currentColor; stroke-width: 1.5; }
.js_clik-ph-play[aria-pressed="true"] { background: linear-gradient(135deg, #0A5CFF, #7C3AED); border-color: transparent; }
.clik-ph-zoom { height: 40px; min-width: 64px; padding: 0 12px; border-radius: 20px; font: 700 13px/1 inherit; cursor: pointer; font-variant-numeric: tabular-nums; }
.clik-ph-chip { height: 40px; padding: 0 14px; border-radius: 20px; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.clik-ph-chip b { font-weight: 800; }

/* the photos before / after */
.clik-ph-nav { position: absolute; top: 50%; z-index: 3; width: 48px; height: 48px; margin-top: -24px; border-radius: 50%; display: grid; place-items: center; transition: background-color .15s ease, transform .15s ease; }
.clik-ph-stage:has(.clik-ph-strip) .clik-ph-nav { margin-top: -60px; }
.clik-ph-nav.is-prev { inset-inline-start: 16px; }
.clik-ph-nav.is-next { inset-inline-end: 16px; }
.clik-ph-nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
html[dir="rtl"] .clik-ph-nav svg { transform: scaleX(-1); }
.clik-ph-nav:hover { background: rgba(255, 255, 255, .22); color: #fff; }
.clik-ph-nav:active { transform: scale(.9); }

/* the CLIK cube while the photo loads */
.clik-ph-load { position: absolute; left: 50%; top: 50%; width: 68px; height: 68px; margin: -34px 0 0 -34px; z-index: 2; background: var(--clik-cube-load, var(--clik-cube)) center / contain no-repeat; filter: none); animation: clik-cube-in .66s cubic-bezier(.2, .9, .3, 1.2) both, clik-feed-cube 1.1s ease-in-out .66s infinite; }
.clik-ph-stage.is-ready .clik-ph-load { display: none; }

.clik-ph-veil { position: absolute; z-index: 2; left: 0; right: 0; top: 50%; margin: -22px auto 0; width: max-content; max-width: calc(100% - 32px); height: 44px; padding: 0 16px; border-radius: 22px; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.clik-ph-veil svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; flex: none; }

/* the strip of the post's photos */
.clik-ph-strip { position: absolute; z-index: 3; bottom: 16px; left: 0; right: 0; margin: 0 auto; width: max-content; max-width: calc(100% - 32px); display: flex; gap: 8px; padding: 8px; border-radius: 16px; overflow-x: auto; scrollbar-width: none; overscroll-behavior: contain; }
.clik-ph-strip::-webkit-scrollbar { display: none; }
.clik-ph-th { flex: none; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; opacity: .55; box-shadow: 0 0 0 2px transparent; transition: opacity .15s ease, transform .15s ease, box-shadow .15s ease; }
.clik-ph-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.clik-ph-th:hover { opacity: 1; transform: translateY(-2px); }
.clik-ph-th.is-blur { display: grid; place-items: center; background: rgba(255, 255, 255, .14); color: #fff; }
.clik-ph-th.is-blur svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.clik-ph-th.is-on { opacity: 1; box-shadow: 0 0 0 2px #fff; }

/* the hint, the slideshow's time line */
.clik-ph-hint { position: absolute; z-index: 3; left: 0; right: 0; margin: 0 auto; bottom: 16px; width: max-content; max-width: calc(100% - 32px); padding: 8px 14px; border-radius: 18px; font-size: 13px; font-weight: 600; text-align: center; opacity: 0; transform: translateY(6px); transition: opacity .3s ease, transform .3s ease; pointer-events: none; }
.clik-ph-stage:has(.clik-ph-strip) .clik-ph-hint { bottom: 104px; }
.clik-ph-hint.is-on { opacity: 1; transform: none; }
.clik-ph-bar { position: absolute; z-index: 4; left: 0; right: 0; top: 0; height: 3px; opacity: 0; transition: opacity .2s ease; pointer-events: none; }
.clik-ph-bar i { display: block; height: 100%; background: linear-gradient(90deg, #0A5CFF, #F5104F, #FFD200); transform: scaleX(0); transform-origin: left center; }
html[dir="rtl"] .clik-ph-bar i { transform-origin: right center; }
.clik-ph-stage.is-playing .clik-ph-bar { opacity: 1; }

/* full screen: the stage alone */
.clik-ph-stage:fullscreen { width: 100vw; height: 100vh; }
.clik-ph-stage:fullscreen .clik-ph-view { inset: 72px 16px 16px; }
.clik-ph-stage:fullscreen:has(.clik-ph-strip) .clik-ph-view { bottom: 104px; }

/* ---- the side: the photo's info, its post, the ads / widgets ---- */
.clik-ph-side { min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 8px; padding: 8px 0; scrollbar-width: thin; }
.clik-ph-side > * { flex: none; }
.clik-ph-info { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 8px; }
.clik-ph-info:not(:has(> :not([hidden]))) { display: none; }
.clik-ph-tag { display: inline-flex; align-items: center; gap: 6px; height: 32px; max-width: 100%; padding: 0 12px; border-radius: 16px; background: #f0f2f5; color: #1c1e21; font-size: 13px; font-weight: 600; text-decoration: none; transition: background-color .15s ease; }
.clik-ph-tag[hidden] { display: none; }
.clik-ph-tag span, .clik-ph-tag b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; font-weight: 600; }
.clik-ph-tag b { unicode-bidi: plaintext; font-variant-numeric: tabular-nums; }
.clik-ph-tag svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
a.clik-ph-tag:hover { background: #e4e6eb; color: #1c1e21; text-decoration: none; }
body.night-mode .clik-ph-tag { background: #3a3b3c; color: #e4e6eb; }
body.night-mode a.clik-ph-tag:hover { background: #4e4f50; color: #fff; }
.clik-ph .clik-ph-post.post { margin: 0 !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; background: transparent !important; }
.clik-ph-extra { padding: 0 8px; display: flex; flex-direction: column; gap: 8px; }
.clik-ph-extra:not(:has(*)) { display: none; }
.clik-ph-extra > * { margin: 0 !important; }

/* ---- phones and tablets: the stage on top, the post under it ---- */
@media (max-width: 991px) {
  .clik-ph-wrap { padding: 0; }
  .clik-ph { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 0; border-radius: 0; box-shadow: none; }
  .clik-ph-stage { height: min(72vh, 640px); min-height: 340px; }
  .clik-ph-side { overflow: visible; padding-bottom: 16px; }
  .clik-ph-view { inset: 64px 8px 16px; }
  .clik-ph-stage:has(.clik-ph-strip) .clik-ph-view { bottom: 88px; }
  .clik-ph-nav { width: 40px; height: 40px; margin-top: -20px; }
  .clik-ph-stage:has(.clik-ph-strip) .clik-ph-nav { margin-top: -56px; }
  .clik-ph-nav.is-prev { inset-inline-start: 8px; }
  .clik-ph-nav.is-next { inset-inline-end: 8px; }
  .clik-ph-tools { top: 8px; inset-inline-end: 8px; max-width: calc(100% - 140px); gap: 8px; }
  .clik-ph-brand { top: 12px; inset-inline-start: 8px; }
  .clik-ph-btn { width: 36px; height: 36px; }
  .clik-ph-btn svg { width: 18px; height: 18px; }
  .clik-ph-chip, .clik-ph-zoom { height: 36px; }
  .clik-ph-strip { bottom: 8px; max-width: calc(100% - 16px); }
  .clik-ph-th { width: 48px; height: 48px; }
  .clik-ph-hint { bottom: 8px; }
  .clik-ph-stage:has(.clik-ph-strip) .clik-ph-hint { bottom: 88px; }
}
@media (max-width: 575px) {
  /* two fingers zoom on a phone: the zoom buttons step aside, rotate / slideshow / full screen / share stay */
  .clik-ph-tools .js_clik-ph-out, .clik-ph-tools .js_clik-ph-in, .clik-ph-tools .clik-ph-zoom { display: none; }
  .clik-ph-stage.is-zoomed .clik-ph-tools .clik-ph-zoom { display: inline-flex; align-items: center; }
  .clik-ph-brand .clik-brand { transform: scale(.82); transform-origin: top left; }
  html[dir="rtl"] .clik-ph-brand .clik-brand { transform-origin: top right; }
}

/* ---- motion (never with "less motion") ---- */
@media (prefers-reduced-motion: no-preference) {
  .clik-ph.is-motion .clik-ph-view { animation: clik-ph-in .5s cubic-bezier(.2, .8, .3, 1) backwards; }
  .clik-ph.is-motion .clik-ph-tools > *, .clik-ph.is-motion .clik-ph-nav, .clik-ph.is-motion .clik-ph-strip { animation: clik-ph-fade .4s ease backwards; }
  .clik-ph.is-motion .clik-ph-tools > :nth-child(2) { animation-delay: .04s; }
  .clik-ph.is-motion .clik-ph-tools > :nth-child(3) { animation-delay: .08s; }
  .clik-ph.is-motion .clik-ph-tools > :nth-child(4) { animation-delay: .12s; }
  .clik-ph.is-motion .clik-ph-tools > :nth-child(5) { animation-delay: .16s; }
  .clik-ph.is-motion .clik-ph-tools > :nth-child(n+6) { animation-delay: .2s; }
  .clik-ph.is-motion .clik-ph-side > * { animation: clik-ph-up .45s cubic-bezier(.2, .8, .3, 1) backwards; }
  .clik-ph.is-motion .clik-ph-side > :nth-child(2) { animation-delay: .06s; }
  .clik-ph.is-motion .clik-ph-side > :nth-child(3) { animation-delay: .12s; }
  .clik-ph.is-motion .clik-ph-nav.is-prev:hover svg { transform: translateX(-2px); }
  .clik-ph.is-motion .clik-ph-nav.is-next:hover svg { transform: translateX(2px); }
  html[dir="rtl"] .clik-ph.is-motion .clik-ph-nav.is-prev:hover svg { transform: scaleX(-1) translateX(-2px); }
  html[dir="rtl"] .clik-ph.is-motion .clik-ph-nav.is-next:hover svg { transform: scaleX(-1) translateX(2px); }
  .clik-ph-nav svg { transition: transform .15s ease; }
  .clik-ph-stage.is-swap .clik-ph-img { animation: clik-ph-swap .45s cubic-bezier(.2, .8, .3, 1); }
}
@keyframes clik-ph-in { from { opacity: 0; transform: scale(.96); } }
@keyframes clik-ph-fade { from { opacity: 0; } }
@keyframes clik-ph-up { from { opacity: 0; transform: translateY(8px); } }
@keyframes clik-ph-swap { from { opacity: .2; } }
