/* The media page (a grid of small pictures grouped by day) and the picture viewer (full screen, buttons, zoom). Colours are Orbita's. The viewer is always dark, in both themes: a picture
   is looked at on black, and its buttons are Orbita's round glass buttons in their dark version. */

/* ---- the media page */
.media-in { max-width: 980px; gap: 16px; }
.mhead { display: grid; gap: 2px; }
.mhead .psub { margin: 0 0 0 4px; }
.mdays { display: grid; gap: 20px; }
.mday { display: grid; gap: 8px; min-width: 0; }
.mday h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--tx2); font-weight: 700; padding: 0 4px; }
.mgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; border-radius: 14px; overflow: hidden; }
@media (min-width: 560px) { .mgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 820px) { .mgrid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.mtile { position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 0; overflow: hidden; background: var(--bg2); border-radius: 0; }
.mtile img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity 200ms var(--ease); }
.mtile img.on { opacity: 1; }
.mtile.sk { border-radius: 0; }
.mtile.broken::after { content: ''; position: absolute; inset: 0; background: var(--track); }
.mtile:active img { transform: scale(.97); }
.mtile:focus-visible { outline-offset: -3px; }
.mend { height: 1px; }

/* ---- the viewer */
.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(8, 8, 10, var(--fade, 1)); color: #fff; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; animation: fade 200ms var(--ease); }
.v-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: zoom-in; }
.lightbox.zoomed .v-stage { cursor: grab; }
.v-slide { position: absolute; inset: 0; }
.v-slide.in-next { animation: v-in-next .24s var(--ease) both; }
.v-slide.in-prev { animation: v-in-prev .24s var(--ease) both; }
@keyframes v-in-next { from { opacity: 0; transform: translate3d(48px, 0, 0); } }
@keyframes v-in-prev { from { opacity: 0; transform: translate3d(-48px, 0, 0); } }
.v-img { position: absolute; max-width: none; transform-origin: 0 0; opacity: 0; pointer-events: none; -webkit-user-drag: none; user-select: none; }
.v-img.ready { opacity: 1; transition: opacity 200ms var(--ease); }
.v-spin { position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .22); border-top-color: #fff; animation: v-spin .8s linear infinite; }
@keyframes v-spin { to { transform: rotate(360deg); } }
.v-fail { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; gap: 12px; justify-items: center; text-align: center; width: min(86%, 320px); }
.v-fail p { color: rgba(255, 255, 255, .85); }

.v-top { position: absolute; top: 0; left: 0; right: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; pointer-events: none;
  padding: calc(var(--sat) + 8px) calc(var(--sar) + 12px) 20px calc(var(--sal) + 12px); background: linear-gradient(rgba(0, 0, 0, .55), transparent); }
.v-top > * { pointer-events: auto; }
.v-top > :first-child { justify-self: start; }                       /* three columns: the count stays in the middle however many buttons are at the right */
.v-act { justify-self: end; display: flex; align-items: center; gap: 8px; }
.v-btn, .v-nav, .v-level { color: #fff; background: rgba(40, 40, 44, .55); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, .12); text-decoration: none; }
.v-btn { width: 44px; height: 44px; border-radius: 50%; }
.v-count { padding: 7px 14px; border-radius: 999px; font-weight: 650; font-size: 15px; background: rgba(40, 40, 44, .55); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid rgba(255, 255, 255, .12); }
.v-nav { position: absolute; top: 50%; width: 46px; height: 46px; margin-top: -23px; border-radius: 50%; }
.v-nav.prev { left: calc(var(--sal) + 12px); }
.v-nav.next { right: calc(var(--sar) + 12px); }
.v-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: grid; gap: 12px; justify-items: center; pointer-events: none;
  padding: 24px calc(var(--sar) + 12px) calc(var(--sab) + 12px) calc(var(--sal) + 12px); background: linear-gradient(transparent, rgba(0, 0, 0, .6)); }
.v-bottom > * { pointer-events: auto; }
.v-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: rgba(255, 255, 255, .86); pointer-events: none; }
.v-zoom { display: flex; align-items: center; gap: 8px; }
.v-level { min-width: 76px; height: 44px; padding: 0 12px; border-radius: 999px; font-weight: 650; font-size: 15px; }
.lightbox button:disabled { opacity: .35; }
.lightbox :focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (hover: hover) { .v-btn:hover:not(:disabled), .v-nav:hover, .v-level:hover:not(:disabled) { background: rgba(70, 70, 76, .7); } }
@media (prefers-reduced-motion: reduce) { .lightbox, .v-slide, .v-spin { animation-duration: .01ms; } .v-img { transition: none !important; } }

/* ---- the three buttons of the media page (Immagini · Audio · Video, each with how many), and the rows of the sound and the video */
.mkinds { margin: 2px 0 2px; }
.mkinds .seg > * { padding: 0 4px; min-width: 0; font-size: 13px; gap: 5px; }
.mkinds .seg .ic { width: 16px; height: 16px; flex: none; }
.seg-n { font-weight: 700; color: var(--tx3); font-size: 12px; font-variant-numeric: tabular-nums; }
.seg > .on .seg-n { color: var(--tx2); }
.seg-n[hidden] { display: none; }
@media (max-width: 359px) { .mkinds .seg .ic { display: none; } }          /* (on the narrowest phones the words and the numbers are what fit) */
.mrows { display: grid; gap: 14px; }
.mrows[hidden], .mdays[hidden], .mend[hidden] { display: none; }
