/* Gallery styles stay independent of article typography and editor controls. */
.article-gallery{margin:1.75rem 0;border:1px solid #dbe2ea;border-radius:16px;overflow:hidden;background:#fff;color:#172033;font-family:inherit}
.article-gallery:not(.article-gallery-enhanced){padding:12px;display:grid;gap:12px}
.article-gallery:not(.article-gallery-enhanced)>figure{margin:0}
.article-gallery:not(.article-gallery-enhanced)>figure>img{width:100%;height:auto;border-radius:8px}
.article-gallery:not(.article-gallery-enhanced) figcaption{font-size:.9rem;line-height:1.5;margin-top:6px}
.article-gallery [hidden],.article-gallery-dialog [hidden]{display:none!important}
.article-gallery button,.article-gallery-dialog button{font:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}
.article-gallery button:focus-visible,.article-gallery-dialog button:focus-visible{outline:3px solid #2563eb;outline-offset:3px}
.article-gallery-header{display:flex;align-items:center;gap:12px;padding:14px 16px}
.article-gallery-open{flex:none;display:inline-flex;align-items:center;min-height:42px;padding:8px 14px;border:1px solid #bfdbfe;border-radius:10px;background:#eff6ff;color:#1d4ed8;font-weight:700!important;font-size:.9rem!important;line-height:1.2}
.article-gallery-open:hover{background:#dbeafe}
.article-gallery-title{flex:1;min-width:0;margin:0!important;font-size:1rem!important;line-height:1.4!important;font-weight:650;overflow-wrap:anywhere}
.article-gallery-count{flex:none;margin-left:auto;font-variant-numeric:tabular-nums;font-size:.85rem;line-height:1.4;color:#526175;white-space:nowrap}
.article-gallery-frame{position:relative;background:#101826;aspect-ratio:16/10;max-height:540px;min-height:180px;touch-action:pan-y}
.article-gallery-photo{display:flex;width:100%;height:100%;align-items:center;justify-content:center;border:0;padding:0;margin:0;background:transparent;color:#fff;position:relative;overflow:hidden}
.article-gallery-image{display:block!important;width:100%!important;height:100%!important;max-width:none!important;max-height:100%;object-fit:contain;margin:0!important;border:0;border-radius:0!important;user-select:none}
.article-gallery-image[hidden]{display:none!important}
.article-gallery-enlarge{position:absolute;bottom:14px;left:50%;transform:translateX(-50%);max-width:calc(100% - 32px);padding:7px 12px;border-radius:20px;background:rgba(15,23,42,.82);color:#fff;font-size:.75rem;line-height:1.35;white-space:nowrap;pointer-events:none}
.article-gallery-arrow{position:absolute;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:44px;height:48px;border:1px solid rgba(255,255,255,.4);border-radius:10px;background:rgba(15,23,42,.82);color:#fff;font-size:2rem!important;line-height:1;font-family:Arial,sans-serif!important;padding:0;box-shadow:0 1px 5px #0003}
.article-gallery-arrow:hover{background:#1e40af}
.article-gallery-previous{left:12px}.article-gallery-next{right:12px}
.article-gallery-caption{padding:12px 16px 0;margin:0!important;color:#475569;font-size:.9rem!important;line-height:1.6!important;overflow-wrap:anywhere}
.article-gallery-thumbnails{display:flex;position:relative;gap:8px;padding:14px 16px;overflow-x:auto;overscroll-behavior-inline:contain;scrollbar-width:thin;scrollbar-color:#94a3b8 transparent}
.article-gallery-thumbnail{position:relative;flex:0 0 76px;width:76px;height:58px;padding:0;border:2px solid transparent;border-radius:8px;background:#e2e8f0;overflow:hidden;opacity:.78}
.article-gallery-thumbnail:hover{opacity:1}.article-gallery-thumbnail[aria-current=true]{border-color:#2563eb;opacity:1;box-shadow:0 0 0 2px #fff,0 0 0 4px #2563eb}
.article-gallery-thumbnail img{display:block;width:100%!important;height:100%!important;object-fit:cover;margin:0!important;border-radius:0!important}
.article-gallery-thumbnail-number{position:absolute;right:3px;bottom:3px;min-width:17px;border-radius:4px;padding:1px 4px;background:rgba(15,23,42,.82);color:#fff;font-size:10px;line-height:1.4}
.article-gallery-error{max-width:320px;margin:0!important;padding:24px 52px;text-align:center;color:#f1f5f9;font-size:.95rem;line-height:1.5}
.article-gallery-dialog{position:fixed;inset:0;box-sizing:border-box;width:100%;height:100vh;height:100dvh;max-width:none;max-height:none;margin:0;padding:0;border:0;border-radius:0;background:#0f172a;color:#f8fafc;overflow:hidden;overscroll-behavior:contain}
.article-gallery-dialog[open]{display:flex;flex-direction:column}
.article-gallery-dialog::backdrop{background:rgba(2,6,23,.84);backdrop-filter:blur(4px)}
.article-gallery-dialog-header{flex:none;display:grid;grid-template-columns:minmax(0,1fr) auto auto auto;align-items:center;gap:12px;padding:8px 16px;padding-top:max(8px,env(safe-area-inset-top));padding-left:max(16px,env(safe-area-inset-left));padding-right:max(16px,env(safe-area-inset-right));border-bottom:1px solid #334155}
.article-gallery-dialog-title{min-width:0;margin:0;font-size:1rem;line-height:1.4;font-weight:650;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow-wrap:anywhere}
.article-gallery-dialog .article-gallery-count{color:#cbd5e1;margin-left:0}
.article-gallery-zoom-controls{display:flex;align-items:center;gap:4px;flex:none}
.article-gallery-zoom-controls button{display:grid;place-items:center;min-width:44px;height:44px;padding:0 10px;border:1px solid #475569;border-radius:9px;background:#1e293b;color:#f8fafc;font-size:1.25rem;line-height:1}
.article-gallery-zoom-controls .article-gallery-zoom-reset{min-width:64px;font-size:.85rem;font-variant-numeric:tabular-nums}
.article-gallery-zoom-controls button:hover:not(:disabled){background:#334155}
.article-gallery-zoom-controls button:disabled{opacity:.4;cursor:default}
.article-gallery-close{flex:none;display:grid;place-items:center;width:44px;height:44px;border:1px solid #64748b;border-radius:9px;background:#1e293b;color:#fff;font-size:1.8rem!important;line-height:1;padding:0}
.article-gallery-close:hover{background:#334155}
.article-gallery-dialog .article-gallery-view{display:flex;flex-direction:column;flex:1;min-height:0;min-width:0;padding-bottom:env(safe-area-inset-bottom)}
.article-gallery-dialog .article-gallery-frame{flex:1;aspect-ratio:auto;height:auto;min-height:0;max-height:none;overflow:hidden;background:#080e19;touch-action:none}
.article-gallery-dialog .article-gallery-photo{touch-action:none;cursor:zoom-in}
.article-gallery-dialog .article-gallery-photo.is-zoomed{cursor:grab}
.article-gallery-dialog .article-gallery-photo.is-panning{cursor:grabbing}
.article-gallery-dialog .article-gallery-image{transform-origin:center center;-webkit-user-drag:none;transition:none}
.article-gallery-dialog .article-gallery-arrow{width:44px;height:48px;z-index:1}
.article-gallery-dialog .article-gallery-caption{flex:none;box-sizing:border-box;max-height:5em;overflow:auto;color:#e2e8f0;padding:8px max(16px,env(safe-area-inset-right)) 0 max(16px,env(safe-area-inset-left));font-size:.85rem!important;line-height:1.45!important;overscroll-behavior:contain}
.article-gallery-dialog .article-gallery-thumbnails{flex:none;gap:8px;padding:10px max(16px,env(safe-area-inset-right)) 10px max(16px,env(safe-area-inset-left))}
.article-gallery-dialog .article-gallery-thumbnail{background:#334155}
.article-gallery-dialog .article-gallery-thumbnail[aria-current=true]{border-color:#60a5fa;box-shadow:0 0 0 2px #0f172a,0 0 0 4px #60a5fa}
.article-gallery-dialog button:focus-visible{outline-color:#93c5fd}
.dark .article-gallery{border-color:#334155;background:#172033;color:#f1f5f9}
.dark .article-gallery-open{border-color:#1e40af;background:#172d53;color:#bfdbfe}
.dark .article-gallery-open:hover{background:#1e3a5f}
.dark .article-gallery-count,.dark .article-gallery-caption{color:#cbd5e1}
.dark .article-gallery-thumbnail{background:#334155}
.dark .article-gallery-thumbnail[aria-current=true]{border-color:#60a5fa;box-shadow:0 0 0 2px #172033,0 0 0 4px #60a5fa}
.dark .article-gallery button:focus-visible{outline-color:#93c5fd}
@media(max-width:600px){.article-gallery{border-radius:12px;margin:1.5rem 0}.article-gallery-header{padding:10px 12px;gap:8px;flex-wrap:wrap}.article-gallery-title{order:3;flex-basis:100%;font-size:.95rem!important}.article-gallery-frame{aspect-ratio:4/3}.article-gallery-arrow{width:40px;height:44px}.article-gallery-previous{left:8px}.article-gallery-next{right:8px}.article-gallery-caption{padding:10px 12px 0}.article-gallery-thumbnails{padding:12px;gap:8px}.article-gallery-thumbnail{flex-basis:64px;width:64px;height:50px}.article-gallery-enlarge{font-size:.7rem;bottom:10px}.article-gallery-dialog-header{grid-template-columns:minmax(0,1fr) auto auto;column-gap:8px;row-gap:6px;padding-left:max(12px,env(safe-area-inset-left));padding-right:max(12px,env(safe-area-inset-right))}.article-gallery-dialog-title{grid-column:1/-1;font-size:.9rem;-webkit-line-clamp:1}.article-gallery-dialog .article-gallery-count{font-size:.8rem}.article-gallery-dialog .article-gallery-caption{max-height:4em;padding-top:6px;font-size:.8rem!important}.article-gallery-dialog .article-gallery-thumbnails{padding-top:8px;padding-bottom:8px}}
@media(max-height:500px){.article-gallery-dialog-header{grid-template-columns:minmax(0,1fr) auto auto auto;gap:8px;padding-top:max(4px,env(safe-area-inset-top));padding-bottom:4px}.article-gallery-dialog-title{grid-column:auto;font-size:.85rem;-webkit-line-clamp:1}.article-gallery-dialog .article-gallery-caption{max-height:2.5em;padding-top:4px;font-size:.75rem!important}.article-gallery-dialog .article-gallery-thumbnails{padding-top:6px;padding-bottom:6px}.article-gallery-dialog .article-gallery-thumbnail{flex-basis:58px;width:58px;height:44px}}
@media(prefers-reduced-motion:reduce){.article-gallery *,.article-gallery-dialog *{scroll-behavior:auto!important}}
@media print{.article-gallery{break-inside:avoid}.article-gallery-open,.article-gallery-arrow,.article-gallery-enlarge,.article-gallery-thumbnails,.article-gallery-dialog{display:none!important}.article-gallery-frame{background:#fff}.article-gallery-caption{padding-bottom:12px}}
