/* -------------------------
   gallery
------------------------- */

.library.gallery{
  display: grid;
  gap: 14px;
}

.gallery-head{
  display:flex;
  justify-content:center;
}

.gallery-tabs{
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 8px;
  padding: 8px;
  border-radius: 18px;
  background: rgba(17,24,39,.04);
  border: 1px solid var(--line);
  width: min(560px, 100%);
}

.gallery-tabs .tab-btn{
  appearance: none;
  border: 1px solid transparent;
  border-radius: 14px;

  font-family: "Noto Sans JP", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .3px;

  padding: 12px 16px;
  line-height: 1;

  cursor: pointer;
  color: var(--muted);
  background: transparent;

  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  -webkit-tap-highlight-color: transparent;

  transition: background .15s ease, color .15s ease, box-shadow .15s ease, border-color .15s ease, transform .15s ease;
}

.gallery-tabs .tab-btn:hover{
  color: #2F343C;
}

.gallery-tabs .tab-btn[aria-selected="true"]{
  background: #fff;
  color: #2F343C;

  padding: 14px 16px;

  border-color: rgba(17,24,39,.10);
  box-shadow: 0 8px 18px rgba(17,24,39,.08);
}

.gallery-tabs .tab-btn:active,
.gallery-tabs .tab-btn:focus,
.gallery-tabs .tab-btn:focus-visible,
.gallery-tabs .tab-btn:focus-within{
  outline: none !important;
  box-shadow: none !important;
  border-color: transparent !important;
  filter: none !important;
}

.gallery-tabs .tab-btn[aria-selected="true"]:active,
.gallery-tabs .tab-btn[aria-selected="true"]:focus,
.gallery-tabs .tab-btn[aria-selected="true"]:focus-visible,
.gallery-tabs .tab-btn[aria-selected="true"]:focus-within{
  outline: none !important;
  border-color: rgba(17,24,39,.10) !important;
  box-shadow: 0 8px 18px rgba(17,24,39,.08) !important;
  filter: none !important;
}

.gallery-grid{
  display:grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.gallery-item{
  border: 1px solid var(--line);
  background: rgba(255,255,255,.92);
  border-radius: 16px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1 / 1;
}

.gallery-item img{
  width:100%;
  height:100%;
  display:block;
  object-fit: cover;
  transform: scale(1);
  transition: transform .15s ease;
}

.gallery-item:hover img{
  transform: scale(1.03);
}

.gallery-foot{
  display:flex;
  justify-content:center;
  padding-top: 6px;
}

.gallery-showall{
  padding: 10px 14px;
  border-radius: 14px;
}

.lightbox{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  background: rgba(17,24,39,.78);
  backdrop-filter: blur(4px);
}

.lightbox.open{
  display: block;
}

.lb-stage{
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
}

.lb-wrap{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
  max-width: 100%;
  max-height: 100%;
}

.lb-stage img{
  max-width: 96vw;
  max-height: calc(90vh - 54px);
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  display: block;
}

.lb-actions{
  display: flex;
  justify-content: center;
  margin-top: 0;
}

.lb-share-x{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  min-width: 136px;
  height: 42px;
  padding: 0 16px;

  border: none;
  border-radius: 999px;
  background: #000;
  color: #fff;

  font-family: "Noto Sans JP", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;

  transition:
    transform .15s ease,
    background-color .15s ease,
    box-shadow .15s ease;
}

.lb-share-x:hover{
  background: #111;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0,0,0,.28);
}

.lb-share-x:active{
  transform: translateY(0);
  box-shadow: none;
}

.lb-share-x:focus{
  outline: none;
}

.lb-share-x:focus-visible{
  outline: 2px solid rgba(255,255,255,.45);
  outline-offset: 3px;
}

.lb-x-icon{
  width: 14px;
  height: 14px;
  fill: currentColor;
  display: block;
}

.lb-close{
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(17,24,39,.35);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  z-index: 10000;
  pointer-events: auto;
}

body.lb-lock{
  overflow: hidden;
}

.gallery-foot .gallery-showall{
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-width: 240px;
  height: 46px;
  padding: 0 18px;

  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.92);

  font-family: "Noto Sans JP", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .2px;
  color: #4B5563;

  cursor: pointer;

  transition: transform .15s ease,
              box-shadow .15s ease,
              border-color .15s ease,
              background-color .15s ease;

  box-shadow: none;
}

.gallery-foot .gallery-showall:hover{
  transform: translateY(-1px);
  border-color: rgba(17,24,39,.20);
  box-shadow: 0 12px 28px rgba(17,24,39,.08);
  background: rgba(255,255,255,.96);
}

.gallery-foot .gallery-showall:active{
  transform: translateY(0);
  box-shadow: 0 8px 18px rgba(17,24,39,.06);
}

.gallery-foot .gallery-showall:focus{
  outline: none;
}

.gallery-foot .gallery-showall:focus-visible{
  outline: 2px solid rgba(37,99,235,.45);
  outline-offset: 3px;
}

.gallery-foot .gallery-showall:disabled{
  opacity: .6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.gallery-head{
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 52px;
}


@media (max-width: 900px){
  .gallery-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gallery-tabs{ width: min(520px, 100%); }
}

@media (max-width: 520px){
  .gallery-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery-tabs{ padding: 6px; gap: 6px; }
  .gallery-tabs .tab-btn{ padding: 12px 12px; font-size: 12px; }
  .gallery-tabs .tab-btn[aria-selected="true"]{ padding: 14px 12px; }
}

[data-theme="dark"] .gallery-tabs {
  background: rgba(255,255,255,.05);
}

[data-theme="dark"] .gallery-tabs .tab-btn:hover {
  color: #e2e8f0;
}

[data-theme="dark"] .gallery-tabs .tab-btn[aria-selected="true"] {
  background: #3d3b39;
  color: #e2e8f0;
  border-color: rgba(255,255,255,.12);
}

[data-theme="dark"] .gallery-item {
  background: rgba(50,49,47,.95);
}

[data-theme="dark"] .gallery-foot .gallery-showall {
  background: rgba(50,49,47,.95);
  color: #d1d5db;
}

[data-theme="dark"] .gallery-foot .gallery-showall:hover {
  background: rgba(62,60,58,.98);
}


