/* ---------------------------------------------------------------------------
   Home page photo gallery and lightbox (used with asdti-gallery.js).
   The thumbnails look and sit exactly where the old ones did: two across, three
   down, six at a time, with a gentle fade to the next six every few seconds.
   --------------------------------------------------------------------------- */

/* ---------- Thumbnails ---------- */
.ag { position: relative; width: 207px; height: 260px; }
.ag-page { position: absolute; left: 0; top: 0; margin: 0; padding: 0; list-style: none;
           display: grid; grid-template-columns: repeat(2, 81px); grid-auto-rows: 81px; gap: 12px;
           padding: 6px 0 0 16px; opacity: 0; visibility: hidden;
           transition: opacity .9s ease, visibility 0s linear .9s; }
.ag-page.on { opacity: 1; visibility: visible; transition: opacity .9s ease, visibility 0s; }
.ag-page li { margin: 0; padding: 0; list-style: none; }
.ag-thumb { display: block; width: 81px; height: 81px; padding: 3px; box-sizing: border-box; background: #323232;
            box-shadow: 0 0 2px #000000; border-radius: 0; transition: background-color .15s; }
.ag-thumb img { display: block; width: 75px; height: 75px; object-fit: cover; border: 0; opacity: .8; transition: opacity .15s; }
.ag-thumb:hover img, .ag-thumb:focus-visible img { opacity: 1; }
.ag-thumb:hover, .ag-thumb:focus-visible { background: #789f60; }       /* ASDTi green edge when pointed at */
.ag-thumb:focus-visible { outline: 2px solid #ffffff; outline-offset: 1px; }

/* Dots to pick a set of six (only when there are more than six pictures) */
.ag-dots { position: absolute; left: 16px; width: 174px; top: 276px; display: flex; justify-content: center; gap: 6px; }
.ag-dot { width: 16px; height: 14px; padding: 0; margin: 0; border: 0; background: none; cursor: pointer;
          display: flex; align-items: center; justify-content: center; }
.ag-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #6a6a6a; transition: background-color .15s; }
.ag-dot[aria-current="true"]::before { background: #ffffff; }
.ag-dot:hover::before, .ag-dot:focus-visible::before { background: #789f60; }
.ag-dot:focus-visible { outline: 2px solid #ffffff; outline-offset: 0; border-radius: 50%; }

/* ---------- Lightbox ---------- */
.lb { position: fixed; inset: 0; z-index: 10000; display: flex; flex-direction: column; align-items: center; justify-content: center;
      background: rgba(10, 10, 10, .92); opacity: 0; transition: opacity .2s; padding: 56px 72px 24px; box-sizing: border-box;
      font-family: Arial, sans-serif; color: #ffffff; touch-action: pan-y; }
.lb.on { opacity: 1; }
.lb[hidden] { display: none; }
.lb-fig { margin: 0; display: flex; flex-direction: column; align-items: center; max-width: 100%; max-height: 100%; min-height: 0; }
.lb-img { display: block; max-width: 100%; max-height: calc(100vh - 150px); width: auto; height: auto;
          border: 3px solid #ffffff; box-shadow: 0 6px 30px rgba(0, 0, 0, .6); background: #ffffff; transition: opacity .2s; }
.lb-img.loading { opacity: 0; }
.lb-cap { max-width: 800px; margin: 12px 0 0; font-size: 15px; line-height: 1.45; text-align: center; color: #ffffff; }
.lb-cap:empty { display: none; }
.lb-count { position: absolute; left: 20px; top: 18px; font: bold 14px Arial, sans-serif; color: #cccccc; }
.lb-btn { position: absolute; display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer;
          width: 46px; height: 46px; border: 2px solid #ffffff; border-radius: 50%; background: #000000; color: #ffffff;
          font: bold 22px/1 Arial, sans-serif; transition: background-color .15s, border-color .15s; }
.lb-btn:hover, .lb-btn:focus-visible { background: #789f60; border-color: #789f60; }
.lb-btn:focus-visible { outline: 2px solid #ffffff; outline-offset: 3px; }
.lb-close { right: 16px; top: 10px; font-size: 26px; }
.lb-prev  { left: 14px;  top: 50%; margin-top: -23px; }
.lb-next  { right: 14px; top: 50%; margin-top: -23px; }
.lb-single .lb-prev, .lb-single .lb-next, .lb-single .lb-count { display: none; }
html.lb-open, html.lb-open body { overflow: hidden; }

@media (max-width: 700px) {
    .lb { padding: 60px 10px 80px; }
    .lb-img { max-height: calc(100vh - 210px); border-width: 2px; }
    .lb-prev, .lb-next { top: auto; bottom: 16px; margin-top: 0; }
    .lb-prev { left: calc(50% - 60px); }
    .lb-next { right: calc(50% - 60px); }
}

@media (prefers-reduced-motion: reduce) {
    .ag-page, .ag-page.on, .lb, .lb-img { transition: none; }
}
@media print { .lb, .ag-dots { display: none !important; } }
