/* JSTU Cloudshare — dark private gallery */
:root {
  color-scheme: dark;
  --bg: #0e1011;
  --surface: #15181a;
  --surface-2: #1b1f22;
  --raise: #23282c;
  --line: #262b2f;
  --line-strong: #383e43;
  --ink: #e8eaec;
  --muted: #9aa2a8;
  --faint: #6c747a;
  --focus: #8fbccf;
  --star: #f1c76a;
  --r-sm: 8px;
  --r-md: 12px;
  --compact-row-height: 62px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --sans:
    system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  --edge: clamp(12px, 1.5vw, 24px);
  --rail: clamp(172px, 14vw, 218px);
  --gutter: clamp(12px, 1.4vw, 22px);
  margin: 0;
  padding-bottom: max(40px, env(safe-area-inset-bottom));
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
::selection {
  background: #8fbccf4d;
}
button,
input,
select,
a {
  font: inherit;
  color: inherit;
}
h1,
h2,
h3,
p,
figure {
  margin: 0;
}
[hidden] {
  display: none !important;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- Actions ---------- */
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.15s,
    border-color 0.15s,
    color 0.15s,
    opacity 0.15s;
}
button:hover,
.button:hover {
  background: var(--raise);
  border-color: #4a5157;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.primary:hover {
  background: #fff;
  border-color: #fff;
}
.text {
  padding: 0 10px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 400;
}
.text:hover {
  background: #ffffff0d;
  border-color: transparent;
  color: var(--ink);
}
.icon {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
}
.icon:hover {
  background: #ffffff10;
  color: var(--ink);
}
.icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon[aria-pressed="true"] {
  color: var(--star);
}
.icon[aria-pressed="true"] svg {
  fill: currentColor;
}

/* ---------- Fields ---------- */
input,
select {
  min-height: 40px;
  max-width: 100%;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}
input::placeholder {
  color: var(--faint);
}
input:focus,
select:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px #8fbccf2e;
}
.row,
.actions,
.cap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Masthead ---------- */
.mast,
#main {
  padding-inline: var(--edge);
}
.mast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  padding: 8px 0;
  border-radius: 4px;
}
.brand img {
  display: block;
  width: 56px;
  height: auto;
}
nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 2px;
}

/* ---------- Welcome ---------- */
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
body.welcome {
  padding-bottom: 0;
  font-family: Inter, var(--sans);
  background:
    radial-gradient(56% 44% at 50% 40%, #181c1f 0%, #0e101100 72%), var(--bg);
}
.welcome .mast {
  display: none;
}
.welcome main:has(.invitation-heading) {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100svh;
}
.invitation-heading {
  margin: 0;
  padding-top: clamp(20px, 4vw, 40px);
  font-size: 22px;
  overflow-wrap: anywhere;
}
.invitation-heading + .entry {
  min-height: auto;
}
.invitation-heading + .entry .entry-copy {
  width: min(100%, 320px);
}
.entry .welcome-title {
  margin: 0 0 18px;
  font-size: 20px;
  font-weight: 600;
}
.invite-continue {
  gap: 10px;
  border-radius: 8px;
  font-weight: 650;
}
.invite-continue .glyph {
  width: 18px;
  height: 18px;
}
.guest-link {
  margin-top: 6px;
  padding: 6px 2px;
  min-height: 44px;
  background: transparent;
  border: 0;
  color: #c56c71;
  text-decoration: underline;
  text-decoration-color: #874a50;
  text-underline-offset: 3px;
}
.guest-link:hover:not(:disabled), .guest-link:focus-visible {
  color: #efa5a8;
  background: transparent;
  text-decoration: underline;
}
.entry {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 48px 0 calc(48px + 8svh);
}
.entry-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(100%, 284px);
  text-align: center;
}
.welcome-logo {
  display: block;
  width: min(30vw, 220px);
  height: auto;
  margin-bottom: clamp(30px, 5svh, 44px);
}
@media (max-width: 560px) {
  .welcome-logo {
    width: min(46vw, 180px);
  }
}
#entry-actions {
  width: 100%;
}
#entry-actions > [role="status"] {
  color: var(--faint);
  font-size: 13px;
}
#entry-actions > .primary,
.entry .actions .primary {
  width: 100%;
  min-height: 44px;
}
.entry .actions {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
.entry form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.entry form input {
  width: 100%;
  min-height: 44px;
}
.entry form .primary {
  min-height: 44px;
}
#entry-actions > p {
  margin: 0 0 14px;
  color: var(--muted);
}

/* ---------- Page heading, tabs, filters ---------- */
h1 {
  font-size: clamp(21px, 2.4vw, 25px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
}
.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: clamp(28px, 5vw, 44px) 0 18px;
}
.count,
.caption,
.muted {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.tab {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}
.tab:hover {
  background: transparent;
  color: var(--ink);
}
.tab[aria-pressed="true"] {
  background: var(--raise);
  color: var(--ink);
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 20px;
}
.filters:empty {
  margin: 0 0 20px;
}
.chip {
  min-height: 32px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}
.chip:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.chip[aria-pressed="mixed"] {
  border-style: dashed;
  border-color: var(--ink);
  color: var(--ink);
}

/* ---------- Photo rows ---------- */
.photo-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.photo-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-right: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: inset 0 1px 0 #ffffff08;
  transition:
    transform 0.2s var(--ease),
    background-color 0.2s,
    border-color 0.2s,
    box-shadow 0.2s;
  content-visibility: auto;
  contain-intrinsic-size: auto 122px;
}
.photo-open {
  flex: 1;
  min-width: 0;
  justify-content: flex-start;
  gap: 16px;
  min-height: 0;
  padding: 8px;
  border: 0;
  border-radius: calc(var(--r-md) - 1px);
  background: transparent;
  font-weight: 400;
  text-align: left;
  white-space: normal;
}
.photo-open:hover {
  background: transparent;
}
.photo-open:focus-visible {
  outline-offset: -2px;
}
.photo-open img {
  display: block;
  flex: none;
  width: 156px;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.photo-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.photo-name,
.photo-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.photo-name {
  font-size: 15px;
  font-weight: 500;
}
.photo-meta,
.photo-badges {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 4px;
}
.photo-size,
.badge-count {
  flex: none;
}
.photo-badges {
  margin-inline-start: 3px;
}
.photo-badge {
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 5px;
  padding: 2px 5px;
  background: var(--raise);
  color: var(--ink);
  font: 500 11px/1.25 var(--sans);
}
.photo-meta {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
@media (hover: hover) {
  .photo-row:hover {
    transform: translateY(-2px);
    border-color: var(--line-strong);
    background: var(--surface-2);
    box-shadow:
      inset 0 1px 0 #ffffff0d,
      0 14px 28px -18px #000000d9;
  }
}
.photo-row:has(.photo-open:active) {
  transform: scale(0.996);
}
.empty {
  padding: 48px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  color: var(--muted);
  text-align: center;
}

/* ---------- Toast & dialogs ---------- */
#message,
.dialog-notice {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  margin: 0;
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--raise);
  color: var(--ink);
  font-size: 14px;
  box-shadow: 0 16px 36px -16px #000;
}
dialog {
  padding: 0;
  border: 0;
  color: inherit;
}
dialog::backdrop {
  background: #000000b3;
}
.connect-dialog {
  width: min(400px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 28px 64px -28px #000;
}
.connect-dialog h2 {
  margin-bottom: 16px;
  font-size: 17px;
  font-weight: 600;
}
.connect-dialog form input {
  flex: 1 1 180px;
}
.connect-dialog > .text {
  margin-top: 12px;
  margin-left: -10px;
}

/* ---------- Viewer ---------- */
.viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  background: #000;
  color: #eef0f1;
  overscroll-behavior: contain;
}
.viewer::backdrop {
  background: #000;
}
.viewer[open] {
  display: flex;
  flex-direction: column;
}
.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 8px;
  min-height: 56px;
  padding: max(6px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right)) 6px
    max(12px, env(safe-area-inset-left));
}
.viewer-bar > span:first-child {
  color: #ffffff99;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.viewer-foot {
  padding-top: 6px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}
.viewer-foot .row {
  gap: 4px;
  flex-wrap: nowrap;
}
.viewer-caption {
  flex: 1 1 22rem;
  min-width: 0;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.viewer-exposure {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}
.exposure-value {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #b5bbc1;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.exposure-value .glyph {
  width: 14px;
  height: 14px;
}
.viewer-name {
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.viewer .icon {
  color: #ffffffbf;
}
.viewer .icon:hover {
  background: #ffffff14;
  color: #fff;
}
.viewer .icon[aria-pressed="true"] {
  color: var(--star);
}
.viewer .button,
.viewer button:not(.icon, .primary, .tag-key, .new-tag, .tag-form button) {
  border-color: #ffffff24;
  background: #ffffff0d;
}
.viewer .button:hover {
  background: #ffffff1a;
}
.viewer-stage {
  position: relative;
  display: grid;
  flex: 1;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
}
.viewer-stage img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.viewer-info {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 8px 14px;
  border: 1px solid #ffffff1a;
  border-radius: 10px;
  background: #16191be6;
  color: #ffffffbf;
  font-size: 13px;
  white-space: nowrap;
}
.viewer-info:has(button) {
  padding: 6px;
}

/* ---------- Tag editor (viewer, admin) ---------- */
.tag-editor {
  display: grid;
  flex: none;
  gap: 8px;
  padding: 10px max(12px, env(safe-area-inset-right)) 4px
    max(12px, env(safe-area-inset-left));
  border-top: 1px solid #ffffff14;
  background: #0a0b0c;
}
.tag-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
}
.tag-heading > span:first-child {
  color: #ffffff80;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.tag-status {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: #ffffff99;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.new-tag {
  min-height: 32px;
  padding: 0 10px;
  border-color: #ffffff26;
  background: transparent;
  color: #ffffffd9;
  font-size: 13px;
}
.new-tag:hover,
.new-tag[aria-expanded="true"] {
  border-color: #ffffff3d;
  background: #ffffff14;
}
.tag-strip {
  display: flex;
  gap: 6px;
  margin: -2px -12px;
  padding: 2px 12px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 12px;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(
    90deg,
    #0000,
    #000 12px,
    #000 calc(100% - 28px),
    #0000
  );
  mask-image: linear-gradient(
    90deg,
    #0000,
    #000 12px,
    #000 calc(100% - 28px),
    #0000
  );
}
.tag-strip::-webkit-scrollbar {
  display: none;
}
.tag-strip:empty {
  display: none;
}
.tag-key {
  flex: none;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px 0 7px;
  border-color: #ffffff1f;
  background: #ffffff0a;
  color: #ffffffc7;
  font-size: 13px;
  font-weight: 400;
  scroll-snap-align: start;
}
.tag-key:hover {
  border-color: #ffffff33;
  background: #ffffff14;
  color: #fff;
}
.tag-key kbd {
  min-width: 24px;
  padding: 4px 5px;
  border-radius: 5px;
  background: #ffffff12;
  color: #ffffff8c;
  font: 500 11px/1 var(--sans);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.tag-key[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}
.tag-key[aria-pressed="true"] kbd {
  background: #0e10111a;
  color: #0e1011a6;
}
.tag-key:disabled {
  opacity: 0.7;
  border-style: dashed;
  cursor: progress;
  animation: pending 1.2s ease-in-out infinite;
}
@keyframes pending {
  50% {
    opacity: 0.4;
  }
}
.tag-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 4px;
}
.tag-form input {
  flex: 1 1 200px;
  border-color: #ffffff26;
  background: #000;
  color: #fff;
}
.tag-form button {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}
.tag-form button:hover {
  background: #fff;
}
@media (hover: none) {
  .tag-key kbd {
    display: none;
  }
  .tag-key {
    padding: 0 12px;
  }
}

/* ---------- Studio ---------- */
.studio-section {
  padding: 24px 0;
  border-top: 1px solid var(--line);
}
.studio-section h2 {
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.studio-section .row + .row {
  margin-top: 10px;
}
.studio-section form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.studio-section form input {
  flex: 1 1 180px;
}
.invite-result {
  width: min(100%, 460px);
  font-family: var(--mono);
  font-size: 12px;
}
.table-scroll {
  margin-top: 16px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}
.studio-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}
.studio-table th,
.studio-table td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.studio-table tbody tr:last-child td {
  border-bottom: 0;
}
.studio-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.studio-table th:first-child,
.studio-table td:first-child {
  width: 1%;
  padding-right: 4px;
}
.studio-table td:nth-child(n + 3) {
  color: var(--muted);
}
.studio-table tbody tr:hover {
  background: #ffffff05;
}
.studio-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--ink);
  cursor: pointer;
}
.checkwrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  cursor: pointer;
}
.studio-preview {
  justify-content: flex-start;
  gap: 12px;
  min-height: 0;
  padding: 4px 10px 4px 4px;
  border: 0;
  background: transparent;
  font-size: 13px;
  text-align: left;
}
.studio-preview:hover {
  background: var(--raise);
}
.studio-preview:focus-visible {
  outline-offset: 0;
}
.studio-preview img {
  flex: none;
  width: 56px;
  height: 38px;
  object-fit: cover;
  border-radius: 5px;
  background: var(--surface-2);
}

/* ---------- Touch, small screens, motion ---------- */
@media (pointer: coarse) {
  button,
  .button,
  input,
  select {
    min-height: 44px;
  }
  input,
  select {
    font-size: 16px;
  }
  .icon {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }
  .tab {
    min-height: 38px;
  }
  .chip,
  .tag-key {
    min-height: 40px;
  }
  .new-tag {
    min-height: 36px;
  }
  .photo-open,
  .studio-preview {
    min-height: 0;
  }
  .studio-table input[type="checkbox"] {
    min-height: 0;
  }
  .checkwrap {
    min-width: 44px;
    min-height: 44px;
  }
}
@media (max-width: 620px) {
  .mast {
    min-height: 56px;
  }
  .brand img {
    width: 48px;
  }
  .mast .text {
    padding: 0 8px;
    font-size: 13px;
  }
  .tabs {
    display: flex;
  }
  .tab {
    flex: 1;
  }
  .photo-row {
    padding-right: 2px;
    contain-intrinsic-size: auto 86px;
  }
  .photo-open {
    gap: 12px;
    padding: 6px;
  }
  .photo-open img {
    width: 104px;
    border-radius: 6px;
  }
  .photo-name {
    font-size: 14px;
  }
  .photo-meta {
    font-size: 12px;
  }
  .viewer-bar .button {
    padding: 0 10px;
    font-size: 13px;
  }
  .studio-table th,
  .studio-table td {
    padding: 4px 8px;
  }
  .studio-preview img {
    width: 48px;
    height: 32px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    scroll-behavior: auto !important;
  }
  .photo-row {
    transition:
      background-color 0.2s,
      border-color 0.2s,
      box-shadow 0.2s;
  }
  .photo-row:hover,
  .photo-row:has(.photo-open:active) {
    transform: none;
  }
}

/* Recipient gallery filters and download selection */
.gallery-layout {
  display: grid;
  grid-template-columns: minmax(var(--rail), 1fr) minmax(0, 1120px) minmax(
      var(--rail),
      1fr
    );
  gap: var(--gutter);
  align-items: start;
}
.gallery-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
}
.gallery-results {
  min-width: 0;
}
.filter-side {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  width: var(--rail);
  position: sticky;
  top: 16px;
}
.filter-panel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  max-height: calc(100dvh - 32px);
  overflow: auto;
}
.filter-head,
.selection-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.filter-head {
  justify-content: space-between;
}
.filter-head h2 {
  font-size: 15px;
}
.filter-group {
  border: 0;
  border-top: 1px solid var(--line);
  min-width: 0;
  margin: 16px 0 0;
  padding: 5px 0 0;
}
.filter-group legend {
  padding: 0 7px 0 0;
  font-size: 13px;
  font-weight: 600;
}
.filter-option,
.photo-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.filter-option {
  min-height: 34px;
  overflow-wrap: anywhere;
  font-size: 13px;
}
.filter-option input,
.photo-check input {
  flex: none;
  width: 17px;
  height: 17px;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--focus);
}
.filter-match {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}
.filter-match select {
  min-width: 0;
  width: 100%;
  font-size: 13px;
}
.filter-panel .filter-clear {
  margin-top: 10px;
  font-size: 12px;
}
.filter-launch,
.filter-close {
  display: none;
}
.selection-bar {
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.selection-bar button {
  min-height: 34px;
  padding: 5px 10px;
  font-size: 13px;
}
.selection-count {
  margin-right: auto;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.photo-row > .photo-check {
  min-height: 44px;
  padding: 0 7px 0 14px;
}
.photo-row:has(.photo-check input:checked) {
  border-color: var(--focus);
}
.viewer > .selection-bar {
  flex: none;
  justify-content: center;
  margin: 0;
  padding: 2px 12px 6px;
}
.viewer .selection-count {
  margin-right: 3px;
}
.viewer-choose .photo-check {
  min-height: 44px;
  font-size: 13px;
}
.filter-sheet {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(290px, 90vw);
  height: 100dvh;
  max-height: 100dvh;
  max-width: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
}
.filter-sheet .filter-panel {
  border: 0;
  border-radius: 0;
  padding: 20px;
  max-height: 100dvh;
}
.filter-sheet .filter-close {
  display: inline-flex;
}
@media (max-width: 920px) {
  .gallery-layout {
    display: block;
  }
  .filter-side {
    display: none;
  }
  .filter-launch {
    display: inline-flex;
  }
  .gallery-controls .tabs {
    min-width: 0;
  }
  .photo-row > .photo-check {
    padding: 0 3px 0 9px;
  }
  .photo-row .photo-open img {
    width: clamp(62px, 19vw, 94px);
  }
  .photo-row .photo-open {
    gap: 8px;
  }
  .selection-bar {
    gap: 4px;
  }
  .selection-bar button,
  .filter-option {
    min-height: 44px;
  }
}

.glyph {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tag-pane {
  max-width: 1120px;
  margin-inline: auto;
}
.gallery-head {
  align-items: center;
  gap: 12px 24px;
  padding: clamp(24px, 5vw, 40px) 0 24px;
}
.collection-heading {
  display: grid;
  gap: 4px;
}
.collection-heading h1 {
  font-size: 22px;
  overflow-wrap: anywhere;
}
.view-switch {
  flex: none;
}
.view-switch .tab {
  gap: 6px;
  min-height: 36px;
}
.gallery-content {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}
.gallery-controls {
  border-bottom: 1px solid var(--line);
  min-height: 44px;
  margin-bottom: 12px;
}
.scope-tabs {
  display: flex;
  gap: 16px;
}
.scope-tab {
  position: relative;
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  padding: 0 2px;
  min-height: 44px;
  font-size: 13px;
}
.scope-tab:hover {
  background: transparent;
  color: var(--ink);
}
.scope-tab[aria-pressed="true"] {
  color: var(--ink);
}
.scope-tab[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  inset: auto 2px 0;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
}
.filter-count {
  margin-left: auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.filter-option:has(input:checked) {
  color: var(--ink);
  font-weight: 600;
}
.filter-option {
  color: var(--muted);
}
.photo-row:has(.photo-check input:checked) {
  background: #182126;
}
.folder-path {
  justify-content: flex-start;
  gap: 8px;
  min-height: 44px;
  margin: 0 0 12px;
}
.folder-path h2,
.folder-path .text {
  font-size: 15px;
  overflow-wrap: anywhere;
  white-space: normal;
}
.folder-path .text {
  padding: 0 4px;
}
.folder-path > .glyph,
.folder-row > .glyph {
  width: 13px;
  height: 13px;
  color: var(--muted);
}
.compact-list {
  gap: 4px;
}
.compact-list .photo-row {
  min-height: var(--compact-row-height);
  contain-intrinsic-block-size: auto calc(var(--compact-row-height) - 2px);
}
.compact-list .photo-open {
  align-self: stretch;
  gap: 10px;
  padding: 4px;
}
.compact-list .photo-open img {
  width: 54px;
  height: 36px;
}
.compact-list .photo-check {
  align-self: stretch;
  justify-content: center;
  min-width: 44px;
  padding: 0;
}
.folder-list {
  list-style: none;
  padding: 0;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.folder-list li + li {
  border-top: 1px solid var(--line);
}
.folder-row {
  width: 100%;
  min-height: var(--compact-row-height);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  text-align: left;
  padding: 10px 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.folder-list li:first-child .folder-row {
  border-top-left-radius: var(--r-md);
  border-top-right-radius: var(--r-md);
}
.folder-list li:last-child .folder-row {
  border-bottom-left-radius: var(--r-md);
  border-bottom-right-radius: var(--r-md);
}
.folder-row:hover {
  background: var(--surface-2);
}
.folder-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: #b3cbd5;
}
.folder-mark .glyph {
  width: 20px;
  height: 20px;
}
.folder-title {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}
.folder-total {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.group-edit-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: 8px 24px;
  margin-top: 12px;
}
.group-edit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 8px 0;
  min-width: 0;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.group-edit-row select {
  max-width: 55%;
}
@media (max-width: 700px) {
  .gallery-head {
    gap: 16px;
    padding: 24px 0 16px;
  }
  .view-switch .tab,
  .folder-path .text {
    min-height: 44px;
  }
  .folder-row {
    padding: 8px 12px;
    gap: 8px;
  }
}
@media (max-width: 430px) {
  .gallery-head {
    display: grid;
  }
  .view-switch {
    justify-self: stretch;
  }
  .view-switch .tab {
    padding-inline: 6px;
  }
}

.recipient-detail:empty {
  display: none;
}
.recipient-panel {
  margin-top: 16px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.recipient-panel h3 {
  font-size: 14px;
  font-weight: 600;
}
.recipient-panel .muted,
.recipient-panel h3 {
  margin-block: 12px 6px;
}
.recipient-panel strong {
  font-size: 14px;
}
.invite-history {
  list-style: none;
  margin: 12px 0;
  padding: 0;
  max-height: 18rem;
  overflow: auto;
}
.invite-history li {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: baseline;
  border-top: 1px solid var(--line);
  padding: 9px 0;
  font-size: 12px;
  color: var(--muted);
}
.invite-history strong {
  color: var(--ink);
}
.recipient-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 8px 0 0;
}
.recipient-metrics dt {
  color: var(--muted);
  font-size: 12px;
}
.recipient-metrics dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 550px) {
  .gallery-head {
    display: grid;
  }
  .view-switch {
    justify-self: stretch;
  }
  .view-switch .tab {
    flex: 1;
    padding-inline: 4px;
  }
  .view-switch .glyph {
    display: none;
  }
}

.filter-subgroup {
  min-width: 0;
  margin: 9px 0 12px 2px;
  padding: 0 0 0 10px;
  border: 0;
  border-left: 1px solid var(--line-strong);
}
.filter-subgroup legend {
  padding: 0 4px 3px 0;
  font-size: 12px;
  color: var(--muted);
}
.photo-deck {
  min-width: 0;
  padding: 0 clamp(5px, 1.6vw, 20px) 6px;
}
.featured-shelf {
  margin: 0 auto 12px;
  width: min(100%, 1120px);
}
.deck-controls,
.deck-nav,
.deck-caption {
  display: flex;
  align-items: center;
  gap: 10px;
}
.deck-controls,
.deck-caption {
  justify-content: space-between;
}
.deck-controls {
  min-height: 44px;
  margin-bottom: 4px;
}
.deck-heading {
  font-size: 15px;
  font-weight: 600;
}
.deck-nav {
  gap: 2px;
}
.deck-nav .count {
  font-size: 12px;
  min-width: 46px;
  text-align: center;
}
.deck-frame {
  position: relative;
  isolation: isolate;
  perspective: 1600px;
  margin: 0 5px;
}
.deck-frame.has-stack {
  margin-bottom: 12px;
}
.deck-frame.has-stack::before,
.deck-frame.has-stack::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: var(--surface-2);
  transform: translateY(5px) scale(0.984) rotate(-0.5deg);
}
.deck-frame.has-stack::before {
  z-index: -2;
  transform: translateY(10px) scale(0.966) rotate(0.65deg);
}
.deck-face {
  width: 100%;
  height: clamp(245px, 59svh, 670px);
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: #101214;
  cursor: zoom-in;
  touch-action: pan-y pinch-zoom;
  transition:
    transform 0.23s var(--ease),
    box-shadow 0.23s var(--ease);
}
.deck-face img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.has-featured-cover {
  width: min(100%, 960px);
  margin-inline: auto;
}
.has-featured-cover .deck-face {
  position: relative;
  display: block;
  height: auto;
  min-height: 0;
  aspect-ratio: 4 / 3;
  border: 0;
}
.has-featured-cover .deck-face img {
  position: absolute;
  inset: 0;
  object-fit: cover;
}
.has-featured-cover .deck-face[aria-busy="true"]::after {
  inset: 0;
  display: grid;
  place-items: center;
}
.featured-shelf .featured-deck {
  /* Reserve the rest of the first screen for navigation, caption and first row. */
  width: min(100%, 740px, max(172px, calc(133.333svh - 610px)));
}
.featured-deck .deck-frame {
  margin: 0;
}
.featured-deck .deck-frame::before,
.featured-deck .deck-frame::after {
  content: none;
}
.deck-caption {
  padding: 8px 5px 4px;
  min-height: 44px;
}
.deck-caption .photo-check {
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
}
.deck-retry {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .deck-face:hover {
    transform: translateY(-4px) rotateX(0.8deg) rotateZ(-0.28deg);
    box-shadow: 0 14px 25px -15px #000c;
  }
}
@media (max-width: 700px) {
  .deck-face {
    height: clamp(230px, 53svh, 500px);
  }
  .photo-deck {
    padding-inline: 2px;
  }
}

.feature-option {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0 10px;
}
.feature-option label {
  gap: 5px;
  font-size: 12px;
  cursor: pointer;
}
.feature-option input {
  width: 15px;
  height: 15px;
  min-height: 0;
  margin: 0;
  accent-color: var(--focus);
}

.deck-face[aria-busy="true"] img {
  opacity: 0;
}
.deck-face[aria-busy="true"]::after {
  content: "Loading photograph…";
  position: absolute;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 550px) {
  .gallery-controls {
    flex-wrap: wrap;
    gap: 0 6px;
  }
  .scope-tabs {
    gap: 8px;
  }
  .scope-tab {
    padding-inline: 0;
  }
}

.deck-face.has-placeholder[aria-busy="true"] .cover-placeholder {
  opacity: 1;
}
.deck-face.has-placeholder[aria-busy="true"]::after {
  content: none;
}

@media (max-width: 550px) and (max-height: 740px) {
  .gallery-head {
    padding-block: 12px;
    gap: 8px;
  }
  .collection-heading {
    gap: 2px;
  }
}
@media (orientation: portrait) and (max-width: 550px) and (max-height: 640px) {
  .featured-shelf .featured-deck {
    width: min(100%, 405px);
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    align-content: center;
    align-items: center;
    column-gap: 12px;
  }
  .featured-deck .deck-frame {
    grid-area: 1 / 1 / 4 / 2;
  }
  .featured-deck .deck-controls {
    display: contents;
  }
  .featured-deck .deck-heading {
    grid-area: 1 / 2;
  }
  .featured-deck .deck-caption {
    grid-area: 2 / 2;
    min-height: 0;
    padding: 2px 0;
  }
  .featured-deck .deck-nav {
    grid-area: 3 / 2;
    justify-content: start;
  }
  .featured-deck .deck-nav .count {
    min-width: 30px;
  }
}
@media (max-width: 360px) {
  .scope-tabs {
    gap: 5px;
  }
  .scope-tab,
  .filter-launch {
    font-size: 12px;
  }
  .filter-launch,
  .gallery-results .selection-bar button {
    padding-inline: 5px;
  }
}

.featured-shelf .paired-deck {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(10px, 1.2vw, 18px);
  width: min(100%, max(360px, calc(266.666svh - 1240px)));
  padding-inline: 0;
}
.paired-deck .deck-controls {
  grid-column: 1 / -1;
}
.paired-deck .deck-frame {
  grid-row: 2;
}
.paired-deck .deck-caption {
  grid-row: 3;
  min-width: 0;
  padding-inline: 0;
}

@media (orientation: landscape) and (max-height: 540px) {
  .mast {
    min-height: 44px;
  }
  .gallery-head {
    padding-block: 8px;
  }
  .featured-shelf .paired-deck {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1.12fr) minmax(0, 1fr));
    align-items: center;
  }
  .paired-deck .deck-controls {
    display: contents;
  }
  .paired-deck .deck-heading {
    grid-area: 1 / 2;
    align-self: start;
    padding-top: 4px;
  }
  .paired-deck .deck-nav {
    grid-area: 1 / 4;
    align-self: start;
    justify-self: end;
  }
  .paired-deck .deck-frame,
  .paired-deck .deck-caption {
    grid-row: 1;
  }
  .paired-deck .deck-frame {
    grid-column: 1;
  }
  .paired-deck .deck-frame ~ .deck-frame {
    grid-column: 3;
  }
  .paired-deck .deck-caption {
    grid-column: 2;
  }
  .paired-deck .deck-caption ~ .deck-caption {
    grid-column: 4;
  }
}
@media (orientation: landscape) and (max-height: 540px) and (min-width: 760px) {
  .gallery-content:has(.paired-deck) {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
  }
  .gallery-content:has(.paired-deck) > .featured-shelf {
    grid-column: 1/-1;
    margin-bottom: 0;
  }
  .gallery-content:has(.paired-deck) > .gallery-controls {
    margin-bottom: 0;
  }
  .gallery-content:has(.paired-deck) > .gallery-results {
    display: contents;
  }
  .gallery-content:has(.paired-deck) > .gallery-results > .selection-bar {
    margin: 0;
  }
  .gallery-content:has(.paired-deck) .photo-list {
    grid-column: 1/-1;
  }
}
