.lg-gallery {
  --lg-text: #17191d;
  --lg-muted: #606671;
  --lg-paper: #fff;
  --lg-soft: #f4f5f7;
  --lg-line: #dfe2e8;
  --lg-accent: #1254ca;
  --lg-tint: #edf3ff;
  --lg-solid: #155be1;
  --lg-gap: 14px;
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  padding: 20px 20px 88px;
  color: var(--lg-text);
  background: var(--lg-paper);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  container-type: inline-size;
}

:is([data-mantine-color-scheme="dark"], [data-theme="dark"], .dark) .lg-gallery {
  --lg-text: #f3f4f7;
  --lg-muted: #b8bbc3;
  --lg-paper: #1c1c1c;
  --lg-soft: #282a2e;
  --lg-line: #41444b;
  --lg-accent: #8bb6ff;
  --lg-tint: #252f43;
  --lg-solid: #245cce;
  color-scheme: dark;
}

.studio-main .lg-gallery {
  padding: 0;
  background: var(--shell-bg, var(--lg-paper));
}

.lg-gallery *, .lg-gallery *::before, .lg-gallery *::after { box-sizing: border-box; }
.lg-gallery :is(h1, h2, p, dl, dd) { margin: 0; }
.lg-gallery :is(input, button) { font: inherit; letter-spacing: 0; }
.lg-gallery button { cursor: pointer; }
.lg-gallery button:disabled { cursor: not-allowed; opacity: .55; }
.lg-gallery a { text-decoration: none; }
.lg-gallery :is(a, button, input):focus-visible {
  outline: 2px solid var(--lg-accent);
  outline-offset: 2px;
}
.lg-gallery ::selection { color: var(--lg-text); background: var(--lg-tint); }

.lg-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 16px;
}
.lg-gallery .lg-title {
  min-width: 0;
  color: var(--lg-text);
  font-size: 23px;
  line-height: 1.35;
  font-weight: 650;
}
.lg-tabs {
  display: flex;
  align-items: center;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}
.lg-model {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--lg-text);
  border: 1px solid var(--lg-line);
  border-radius: 7px;
  background: var(--lg-paper);
}
.lg-model-label { display: grid; min-width: 0; gap: 3px; }
.lg-model-label b { font-size: 14px; font-weight: 600; line-height: 1.3; }
.lg-by { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-model-label small { color: var(--lg-muted); font-size: 12px; }
.lg-model:hover { border-color: var(--lg-accent); color: var(--lg-accent); }
.lg-model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(232px, 100%), 1fr));
  gap: var(--lg-gap);
}
.lg-model { padding: 8px; }
.lg-model .lg-media { width: 72px; height: 72px; border-radius: 4px; }
.lg-tabs {
  gap: 22px; padding: 2px 3px 0; border-bottom: 1px solid var(--lg-line); margin-bottom: 10px;
}
.lg-tab {
  position: relative; flex: none; display: grid; align-items: center; min-height: 42px;
  color: var(--lg-muted); font-size: 15px; font-weight: 550;
}
.lg-tab:is(:hover, [aria-current="page"]) { color: var(--lg-text); }
.lg-tab[aria-current="page"] { font-weight: 700; }
.lg-tab[aria-current="page"]::after {
  content: ""; position: absolute; height: 2px; inset: auto 0 0; background: var(--lg-accent);
}
.lg-gallery .lg-tab:focus-visible, .lg-gallery .lg-chip:focus-visible { outline-offset: -2px; }
.lg-filters { display: flex; flex-wrap: wrap; gap: 4px 8px; padding: 0 0 14px; }
.lg-filters > * { flex: none; }
.lg-chip, .lg-button, .lg-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 32px;
  padding: 5px 12px;
  border: 1px solid var(--lg-line);
  border-radius: 6px;
  background: var(--lg-paper);
  color: var(--lg-text);
  font-size: 13px;
  line-height: 1.4;
}
.lg-chip:hover, .lg-button:hover:not(:disabled) {
  background: var(--lg-tint);
  color: var(--lg-accent);
}
.lg-filters .lg-chip { border-color: transparent; background: transparent; color: var(--lg-muted); }
.lg-filters .lg-chip:is([aria-pressed="true"], :hover) { background: var(--lg-soft); color: var(--lg-text); }
.lg-filters .lg-chip[aria-pressed="true"] { background: var(--lg-text); color: var(--lg-paper); font-weight: 650; }
.lg-primary { background: var(--lg-solid); border-color: var(--lg-solid); color: white; }
.lg-primary:hover:not(:disabled) { filter: brightness(1.09); }
.lg-tools, .lg-actions, .lg-model-links { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lg-tools { margin: 0 0 16px; }

.lg-wall {
  display: grid;
  grid-template-columns: repeat(var(--lg-cols, 4), minmax(0, 1fr));
  align-items: start;
  gap: var(--lg-gap);
}
.lg-column { display: grid; align-content: start; min-width: 0; gap: var(--lg-gap); }
.lg-card { position: relative; min-width: 0; margin: 0; }
.lg-gallery a.lg-card-image {
  display: block;
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 6px;
  background: var(--lg-soft);
}
.lg-media {
  display: grid;
  place-items: center;
  flex: none;
  position: relative;
  overflow: hidden;
  background: var(--lg-soft);
}
.lg-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.lg-card-image .lg-media { position: absolute; inset: 0; }
/* override.css otherwise forces auto height on every image-card image. */
.lg-gallery a[data-role="image-card"] .lg-media img { height: 100% !important; }
.lg-missing { padding: 4px; color: var(--lg-muted); text-align: center; font-size: 12px; }
.lg-caption { margin: 8px 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.lg-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 30px;
  padding: 0 2px;
  line-height: 1.3;
}
.lg-by, .lg-text-button { color: var(--lg-muted); font-size: 12px; }
.lg-text-button {
  flex: none;
  padding: 4px 1px;
  border: 0;
  background: transparent;
}
.lg-gallery a.lg-by:hover, .lg-text-button:hover { color: var(--lg-accent); }
@media (any-pointer: coarse) {
  .lg-card-meta :is(a,button), .lg-filters .lg-chip { min-height: 40px; align-content: center; }
}
.lg-success {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 7px;
  color: #fff;
  background: #12634e;
  border-radius: 4px;
  font-size: 12px;
}
.lg-pager, .lg-state { text-align: center; color: var(--lg-muted); }
.lg-pager:not(:empty) { padding: 22px 0 6px; }
.lg-state { padding: 24px 10px; }
.lg-state > :not(:first-child) { margin-top: 12px; }
.lg-link, .lg-author { color: var(--lg-accent); }
.lg-link:hover, .lg-author:hover { text-decoration: underline; text-underline-offset: 3px; }
.lg-notice:not(:empty) { margin: 8px 20px; }

.lg-detail-nav, .lg-detail { max-width: 1420px; margin-inline: auto; }
.lg-detail-nav { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--lg-line); }
.lg-detail-nav .lg-return {
  display: inline-flex; gap: 6px; align-items: center; min-height: 32px; color: var(--lg-muted);
}
.lg-detail-nav .lg-return::before, .lg-enlarge::after, .lg-actions button::before, .lg-copy::before {
  content: ""; flex: none; width: 16px; height: 16px; background: currentColor;
  mask: var(--detail-icon) center/contain no-repeat;
}
.lg-detail-nav .lg-return::before { --detail-icon: url("/assets/icons/chevron-right.svg"); transform: rotate(180deg); }
.lg-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr);
  align-items: start;
  gap: clamp(24px, 3%, 48px);
}
.lg-figure { min-width: 0; margin: 0; }
.lg-original { display: block; overflow: hidden; border-radius: 4px; background: var(--lg-soft); }
a.lg-original { cursor: zoom-in; }
.lg-original .lg-media { height: clamp(320px, 70vh, 770px); }
.lg-original img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.lg-figure-caption, .lg-prompt-head, .lg-byline, .lg-enlarge, .lg-copy { display: flex; align-items: center; }
.lg-figure-caption {
  justify-content: space-between; gap: 12px; color: var(--lg-muted); font-size: 13px; font-variant-numeric: tabular-nums;
}
.lg-enlarge, .lg-copy { gap: 6px; min-height: 40px; color: var(--lg-text); }
.lg-enlarge::after { --detail-icon: url("/assets/icons/square-arrow-out-up-right.svg"); }
.lg-info { min-width: 0; padding-top: 4px; }
.lg-info .lg-title { font: 700 30px/1.35 var(--studio-serif, serif); text-wrap: pretty; }
.lg-byline { flex-wrap: wrap; gap: 4px 7px; margin-top: 10px; color: var(--lg-muted); font-size: 13px; }
.lg-byline a { color: var(--lg-text); }
.lg-byline .lg-author + .lg-detail-category { border-inline-start: 1px solid var(--lg-line); padding-inline-start: 10px; margin-inline-start: 3px; }
.lg-actions { margin: 22px 0 24px; }
.lg-actions button { min-height: 42px; gap: 8px; padding-inline: 16px; border-radius: 4px; }
.lg-actions .lg-primary::before { --detail-icon: url("/assets/icons/square-pen.svg"); }
.lg-actions .lg-button::before { --detail-icon: url("/assets/icons/bookmark.svg"); }
.lg-actions .lg-button[aria-pressed="true"] { color: var(--lg-accent); border-color: currentColor; }
.lg-gallery .lg-subhead { margin: 22px 0 8px; color: var(--lg-text); font-size: 15px; font-weight: 650; }
.lg-prompt-section { padding-block: 12px 20px; border-block: 1px solid var(--lg-line); }
.lg-prompt-head { flex-wrap: wrap; gap: 2px 10px; margin-bottom: 8px; }
.lg-prompt-head .lg-subhead { margin: 0; font-size: 17px; }
.lg-prompt-source { color: var(--lg-muted); font-size: 12px; }
.lg-gallery .lg-copy {
  margin-inline-start: auto; padding: 0 4px; border: 0; background: transparent; font-size: 13px;
}
.lg-copy::before { --detail-icon: url("/assets/icons/clipboard-list.svg"); }
:is(.lg-copy, .lg-enlarge, .lg-detail-category, .lg-return):hover { color: var(--lg-accent); }
.lg-prompt { max-width: 70ch; white-space: pre-wrap; color: var(--lg-text); font-size: 15px; line-height: 1.85; }
.lg-prompt-head .studio-copy-input { position: fixed; width: 1px; height: 1px; opacity: 0; }
.lg-settings { padding-block: 12px; border-bottom: 1px solid var(--lg-line); }
.lg-settings summary { padding-block: 6px; cursor: pointer; font-weight: 600; }
.lg-settings summary:focus-visible { outline: 2px solid var(--lg-accent); }
.lg-settings .lg-params { margin-top: 8px; }
.lg-muted { color: var(--lg-muted); }
.lg-params {
  display: grid;
  grid-template-columns: fit-content(42%) minmax(0, 1fr);
  gap: 5px 14px;
  font-variant-numeric: tabular-nums;
}
.lg-params dt { color: var(--lg-muted); }

@container (max-width: 700px) {
  .lg-detail { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .lg-detail-nav { padding-bottom: 6px; margin-bottom: 10px; }
  .lg-original .lg-media { width: 100%; height: auto; max-height: 46svh; aspect-ratio: var(--lg-image-ratio, 1); }
  .lg-info .lg-title { font-size: 25px; }
  .lg-actions { margin: 16px 0 18px; }
  .lg-gallery .lg-actions button, .lg-gallery .lg-copy, .lg-enlarge { min-height: 44px; }
}
@container (max-width: 480px) {
  .lg-heading { flex-wrap: wrap; gap: 9px; margin-bottom: 12px; }
  .lg-gallery .lg-title { font-size: 20px; }
  .lg-tabs { gap: 18px; }
  .lg-filters { gap: 3px; }
  .lg-filters .lg-chip { padding-inline: 9px; }
}
@media (max-width: 720px) {
  .lg-gallery { --lg-gap: 10px; padding: 14px 12px 88px; }
}
