.gallery-main { width: min(100%, 1420px); margin: 0 auto; padding: clamp(24px, 2.5vw, 42px) clamp(16px, 2.7vw, 40px) max(112px, calc(90px + env(safe-area-inset-bottom))); }
.gallery-head { margin-bottom: 20px; }
.gallery-head h1 { margin: 0; font-size: clamp(26px, 2.5vw, 34px); line-height: 1.15; letter-spacing: -.04em; font-weight: 600; }
.gallery-tabs { margin: 0 0 16px; max-width: 100%; overflow-x: auto; scrollbar-width: thin; }
.gallery-tabs a { white-space: nowrap; }
.viewer-links a { display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
#submitImage, .viewer-links a { min-height: 44px; }
.viewer-links svg { width: 17px; height: 17px; }
.gallery-grid, .example-grid { padding: 0; margin: 0; list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 9px; }
.gallery-grid li, .example-grid li { min-width: 0; }
.example-card, .gallery-card { position: relative; display: block; isolation: isolate; overflow: hidden; aspect-ratio: 4 / 5; border-radius: 14px; background: var(--field); color: white; text-decoration: none; }
.example-card img, .gallery-preview, .gallery-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.example-card::after, .gallery-card::after { content: ""; position: absolute; pointer-events: none; inset: 48% 0 0; background: linear-gradient(transparent 12%, #0002 45%, #000a); }
.example-caption, .gallery-caption { position: absolute; z-index: 1; bottom: 12px; inset-inline: 12px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; font-size: clamp(13px, 1.1vw, 16px); font-weight: 550; line-height: 1.3; text-shadow: 0 1px 4px #0008; }
.example-card:focus-visible, .gallery-card:focus-visible { outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .example-card img, .gallery-preview img { transition: transform .2s ease; }
  :is(.example-card,.gallery-card):hover img { transform: scale(1.025); }
}
.gallery-preview .illustration-placeholder { height: 100%; aspect-ratio: auto; }
.gallery-dock { position: fixed; z-index: 2; inset: auto 0 max(12px, env(safe-area-inset-bottom)) var(--compact-width); padding-inline: 14px; display: flex; justify-content: center; pointer-events: none; }
.gallery-composer { pointer-events: auto; width: min(100%, 770px); min-height: 54px; display: grid; align-items: center; grid-template-columns: auto minmax(0,1fr) auto auto auto; gap: 4px; padding: 6px; border-radius: 28px; border: 1px solid var(--line); background: var(--field); box-shadow: 0 4px 22px #0003; }
.gallery-composer:focus-within { border-color: var(--dim); }
.gallery-composer input { min-width: 0; width: 100%; padding: 4px; border: 0; outline: 0; background: transparent; font-size: 16px; }
.gallery-composer input::placeholder { color: var(--muted); }
.gallery-composer .send { width: 40px; height: 40px; grid-column: 5; }
.gallery-composer .mic-monitor { grid-column: 1/-1; }
.dock-price { color: var(--muted); font-size: 13px; white-space: nowrap; }
#moreImages { display: block; margin: 28px auto 0; }
#galleryNotice { color: var(--muted); margin: 0 0 14px; }
@media (max-width: 1090px) { .gallery-grid, .example-grid { grid-template-columns: repeat(4, minmax(0,1fr)); } }
@media (max-width: 800px) { .gallery-grid, .example-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }
.illustration-link, a.gallery-card[data-view-image] .gallery-preview { cursor: zoom-in; }
.image-viewer { width: min(470px, calc(100% - 24px)); max-height: calc(100dvh - 24px); }
.image-viewer.with-picture { width: min(1280px, calc(100% - 36px)); }
.image-viewer .dialog-head { padding-bottom: 16px; }
#viewerZoom { margin-left: auto; }
#viewerZoom[hidden] + #closeImageViewer { margin-left: auto; }
#viewerZoom[aria-pressed="true"] .zoom-plus { display: none; }
.viewer-layout, .viewer-tools { min-width: 0; }
.with-picture .viewer-layout { display: grid; grid-template-columns: minmax(0, 1fr) clamp(250px, 26vw, 330px); }
.viewer-stage { min-width: 0; display: grid; align-content: center; justify-items: center; gap: 8px; background: var(--rail); min-height: min(46dvh, 420px); }
.viewer-viewport { width: 100%; min-width: 0; max-height: min(72dvh, 780px); overflow: auto; overscroll-behavior: contain; }
.viewer-stage img { display: block; width: 100%; height: min(72dvh, 780px); object-fit: contain; cursor: zoom-in; }
.viewer-viewport.enlarged img { width: auto; min-width: 175%; max-width: none; height: auto; max-height: none; cursor: zoom-out; }
.viewer-load { color: var(--muted); margin: 0; }
.viewer-tools { display: flex; flex-direction: column; gap: 20px; padding: 0 var(--dialog-gutter) 24px; }
.with-picture .viewer-tools { padding-top: 16px; max-height: min(76dvh, 850px); overflow-y: auto; border-top: 1px solid var(--soft-line); }
#viewerInfo h3 { margin: 0; font-size: 13px; color: var(--muted); font-weight: 600; }
#viewerCaption { white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0 14px; max-height: 8em; overflow-y: auto; }
.viewer-links { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.viewer-links .secondary { padding: 8px 12px; }
.viewer-links .soft { font-size: 13px; }
#imageForm { display: grid; gap: 9px; }
#imageForm .field, #imageForm p { margin: 0; }
#imageForm textarea { width: 100%; min-height: 85px; max-height: 240px; resize: vertical; }
#submitImage, #useExample { width: 100%; }
.image-viewer:has(#useExample:not([hidden])) #viewerCaption { max-height: none; }
@media (prefers-reduced-motion: no-preference) {
  .gallery-preview .illustration-placeholder::before { animation: illustration-drift 4.5s ease-in-out infinite alternate; }
}
@media (max-width: 760px) {
  .image-viewer.with-picture { width: min(570px, calc(100% - 16px)); }
  .with-picture .viewer-layout { display: block; }
  .with-picture .viewer-tools { max-height: none; overflow: visible; gap: 14px; }
  .viewer-stage { min-height: min(30dvh, 220px); }
  .viewer-stage img { height: auto; max-height: 52dvh; }
  .viewer-viewport { max-height: 52dvh; }
  #viewerCaption { max-height: 4.5em; margin-bottom: 8px; }
}
@media (max-width: 580px) {
  .gallery-main { padding-inline: 12px; }
  .gallery-head { margin-bottom: 16px; }
  .gallery-tabs { gap: 2px; }
  .gallery-tabs a { min-height: 40px; padding-inline: 9px; font-size: 13px; }
  .gallery-grid, .example-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px; }
  .example-card, .gallery-card { border-radius: 11px; }
  .example-caption, .gallery-caption { inset-inline: 8px; bottom: 8px; }
  .gallery-dock { padding-inline: 8px; }
  .gallery-composer { gap: 1px; padding: 4px; }
  .gallery-composer .icon { width: 32px; }
  .gallery-composer input { font-size: 16px; }
  .dock-price { font-size: 11px; }
  .gallery-preview .illustration-placeholder { padding: 7px; gap: 5px; font-size: 11px; }
}
@media (max-width: 380px) {
  .gallery-tabs a { padding-inline: 4px; font-size: 12px; }
}
