/* /gallery: every photo of the day for everyone, newest first, no search (Alpha, 8 Oct 2569) */
/* what the page hides stays hidden, buttons too (.btn sets its own display): the more button showed with nothing more */
.bg [hidden] { display: none !important; }
body.bg { min-height: 100vh; margin: 0; background: radial-gradient(120% 70% at 20% 0%, #6a1424 0%, var(--wine) 50%, var(--night) 100%); color: var(--cream); }
.bg-head { display: flex; gap: 16px; align-items: center; padding: max(16px, env(safe-area-inset-top)) 16px 10px; max-width: 1200px; margin: 0 auto; }
.bg-head .k-brand { --r: 4px; padding: 10px 12px; flex: none; }
.bg-head .k-brand img { height: 34px; width: auto; display: block; }
.bg-title h1 { margin: 2px 0 0; font-size: clamp(22px, 5vw, 30px); color: var(--cream); line-height: 1.2; }
.bg-title p { margin: 2px 0 0; color: #e6d3bd; font-size: 14px; }
.bg-main { max-width: 1200px; margin: 0 auto; padding: 4px 12px 40px; }
.bg-mine { margin: 4px 4px 12px; color: #e6d3bd; font-size: 14px; }
.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.bg-grid button { padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: #3a0d16; aspect-ratio: 3 / 2; cursor: zoom-in; }
.bg-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* every saved photo wears a frame (11 Oct 2569, r18): a long press on a photo offers no save of the unframed file;
   saving goes through the studio's button */
.bg-grid button, .bg-view img { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.bg-grid img, .bg-view img { -webkit-user-drag: none; }
/* r19: a long press or a right click lands on the tile or the viewer, never on the picture itself */
.bg-grid img, .bg-view img { pointer-events: none; }
.bg-empty { text-align: center; color: #e6d3bd; margin: 48px 0; }
.bg-more { display: grid; place-items: center; margin-top: 18px; }
.bg-note { max-width: 34rem; margin: 26px auto 8px; text-align: center; color: rgba(230, 211, 189, .72); font-size: 12.5px; line-height: 1.6; }
/* the photo takes the room the buttons leave and is fitted inside it (r19, 11 Oct 2569): a column of two, the photo
   growing from nothing, so no browser lets it run under the buttons (Safari sized the old grid row from the screen) */
.bg-view { position: fixed; inset: 0; background: rgba(12, 3, 6, .96); display: flex; flex-direction: column; z-index: 20; }
.bg-view[hidden] { display: none; }
.bg-view img { display: block; flex: 1 1 0; width: 100%; height: 0; min-height: 0; object-fit: contain; padding: 12px; box-sizing: border-box; }
.bg-view .bg-bar { flex: none; }
/* r18: the small picture of the grid stands in, blurred, while the full photo comes; the full photo is a progressive
   JPEG, so it covers it whole at once and sharpens as it loads */
.bg-view img { background-origin: content-box; background-clip: content-box; background-position: center; background-size: contain;
  background-repeat: no-repeat; }
.bg-bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 12px 12px max(14px, env(safe-area-inset-bottom)); }
.bg-bar .btn-ghost { color: var(--cream); border-color: rgba(243, 233, 216, .55); background: rgba(255, 255, 255, .06); }
.bg-bar .btn-ghost:disabled { opacity: .35; }
.bg-more .btn { background: var(--cream); color: var(--maroon); }
/* r18: more photos come by themselves near the end of the page; the button stays for a failed load (try again) */
.bg-loading { display: inline-flex; align-items: center; gap: 10px; margin: 6px 0 0; color: #e6d3bd; font-size: 14px; }
.bg-loading i { width: 18px; height: 18px; border-radius: 50%; border: 2.4px solid currentColor; border-right-color: transparent;
  animation: bg-spin .9s linear infinite; }
@keyframes bg-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .bg-loading i { animation-duration: 2.4s; } }
/* the source of the photos (10 Oct 2569): the photographers or the Photo Booth */
.bg-srcs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 4px 12px; }
.bg-srcs button { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 15px; border-radius: 99px; cursor: pointer;
  border: 1px solid rgba(243, 233, 216, .45); background: rgba(255, 255, 255, .06); color: var(--cream); font: inherit; font-size: 14.5px; }
.bg-srcs button b { font-family: 'Anton', var(--font); font-weight: 400; color: #e6d3bd; }
.bg-srcs button.on { background: var(--cream); color: var(--maroon); border-color: var(--cream); }
.bg-srcs button.on b { color: var(--maroon); }

/* pick many photos, then the postcard studio (10 Oct 2569) */
.bg-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 4px 12px; }
.bg-tools .bg-srcs { margin: 0; flex: 1 1 auto; }
.bg-selbtn { height: 40px; padding: 0 16px; border-radius: 99px; border: 1px solid rgba(243, 233, 216, .45); background: rgba(255, 255, 255, .06);
  color: var(--cream); font: inherit; font-weight: 600; cursor: pointer; margin-left: auto; }
.bg-selecting .bg-selbtn { background: var(--cream); color: var(--maroon); }
.bg-selecting .bg-grid button { cursor: pointer; position: relative; }
.bg-selecting .bg-grid button::after { content: ''; position: absolute; right: 8px; top: 8px; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(0, 0, 0, .25); box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.bg-selecting .bg-grid button.picked { outline: 3px solid var(--gold-light); outline-offset: -3px; }
.bg-selecting .bg-grid button.picked::after { background: var(--gold-light) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5 10 17.5 19 7' fill='none' stroke='%233a0710' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
  border-color: var(--gold-light); }
.bg-selecting .bg-main { padding-bottom: 120px; }
.bg-selbar { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 15; max-width: 640px; margin: 0 auto;
  background: var(--cream); color: var(--ink); border-radius: 18px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.bg-selbar[hidden] { display: none; }
.bg-selbar-in { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 12px 12px 16px; }
.bg-selbar-txt { flex: 1 1 180px; min-width: 0; display: grid; gap: 2px; }
.bg-selbar-txt b { font-size: 15.5px; }
.bg-selbar-txt span { font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.bg-selbar .btn { min-height: 44px; }
.bg-selx { height: 44px; padding: 0 12px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }

/* share the gallery (r15): the link carries the guest's share code */
.bg-sharebox { margin-left: auto; display: grid; justify-items: end; gap: 4px; flex: none; }
.bg-share { height: 40px; padding: 0 16px; border-radius: 99px; border: 1px solid rgba(243, 233, 216, .45); background: rgba(255, 255, 255, .06);
  color: var(--cream); font: inherit; font-weight: 600; cursor: pointer; }
.bg-sharemsg { margin: 0; max-width: 260px; font-size: 12.5px; color: #e6d3bd; text-align: right; overflow-wrap: anywhere; }
@media (max-width: 560px) { .bg-head { flex-wrap: wrap; } .bg-sharebox { margin-left: 0; justify-items: start; } .bg-sharemsg { text-align: left; } }
