/* ===== Base ===== */
*,
*::before,
*::after { box-sizing: border-box; }

:root {
  --gap: 12px;
  --page-pad: 12px;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #fafafa;
  color: #111;
}

.headshot{
	border-radius: 50%;
  float:left;
  width:50px;
  margin:0px 12px 5px 0;
}

/* ===== Toolbar / Filter ===== */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #fafafaE6;
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 0 15px;
  border-bottom: 1px solid #e5e5e5;
}

.filter-input {
  width: min(500px, 92vw);
  box-sizing: border-box;
  padding: 12px 14px;
  border-radius: 999px;
  margin: auto;
  margin-top: 13px;
  margin-bottom: 0px;
  border: 1px solid #d6d6d6;
  font-size: 16px;
  outline: none;
}
.filter-input:focus { border-color: #999; }

/* ===== GALLERY =====
   Flex rows so all thumbnails share the same HEIGHT and widths vary.
   Rows are centered (short rows don’t hug the left). */
.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  padding: var(--page-pad);
  justify-content: center;     /* center each row */
  align-content: flex-start;
}

/* Desktop/tablet thumbnails */
.gallery img {
  display: block;
  height: 220px;               /* uniform row height */
  width: auto;                 /* variable width by aspect ratio */
  max-width: none;
  border-radius: 10px;
  background: #eee;
  object-fit: cover;
  cursor: zoom-in;             /* magnifying glass on hover */
  transition: transform .15s ease, filter .15s ease;
}
.gallery img:hover {
  transform: translateY(-2px);
  filter: brightness(.97);
}

/* Responsive row height */
@media (max-width: 900px) { .gallery img { height: 200px; } }
@media (max-width: 600px) { .gallery img { height: 180px; } }

/* Phones: thumbs near full width */
@media (max-width: 480px) {
  .gallery { gap: 10px; padding: 10px; }
  .gallery img {
    height: auto;
    width: min(92vw, 640px);
    max-width: 92vw;
    object-fit: contain;
  }
}

/* ===== LIGHTBOX ===== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;               /* script toggles to block */
  background: rgba(0,0,0,.9);
}
.lightbox.open,
.lightbox[aria-hidden="false"] { display: block; }

.lightbox-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-inline: 56px;        /* arrow breathing room on large screens */
  overflow: hidden;            /* prevent any horizontal spill */
}

.lightbox-stage {
  box-sizing: border-box;
  display: grid;
  place-items: center;
  /* symmetrical horizontal padding so the visual envelope is centered */
  padding-inline: 16px;                     /* phones */
}

/* Big image should NEVER overflow the viewport horizontally.
   Desktop/tablet keeps tall, unified height; phone switches to fit-both-sides. */
.lightbox .lightbox-image {
  display: block;
  border-radius: 8px;
  background: #111;
  object-fit: contain;
  cursor: zoom-out;

  /* Default (desktop/tablet): same height, but cap width just in case */
  height: 80vh;
  width: auto;
  max-width: min(95vw, 1600px);   /* never wider than viewport */
}

/* Hide whichever media type isn't active */
.lightbox .lightbox-image[hidden],
.lightbox .lightbox-video[hidden] { display: none !important; }


/* Give the stage the size envelope; media fills it */
.lightbox-stage--16x9 {                      /* add this class when showing YouTube */
  inline-size: min(95vw, calc(80vh * (16/9)));
  max-inline-size: 95vw;
  block-size: auto;                          /* height is driven by aspect-ratio on child */
}

/* Image/video/iframe all fill the stage width and keep ratio */
.lightbox .lightbox-image,
.lightbox .lightbox-video,
.lightbox .lightbox-youtube,
.lightbox .lightbox-scratch {
  box-sizing: border-box;
  display: block;
  inline-size: 100%;                         /* fill stage width */
  max-inline-size: 100%;
  block-size: auto;
  border: 0;
  border-radius: 8px;
  background: #111;
}

.lightbox .lightbox-scratch {
  background: white;
  padding: 10px;
}

/* Maintain their own constraints (unchanged behavior for image/video) */
.lightbox .lightbox-image,
.lightbox .lightbox-video { max-block-size: 80vh; }

/* YouTube: enforce 16:9 inside the stage’s centered box */
.lightbox .lightbox-youtube {
  aspect-ratio: 16 / 9;
}

/* Scratch iframe: keep the native embed aspect (~485×402 ≈ 1.206) */
.lightbox .lightbox-scratch {
  aspect-ratio: 500 / 410;  /* ≈1.206:1 */
}

/* Caption */
.lightbox .caption {
  max-width: min(95vw, 1200px);
  width: 100%;
  color: #ddd;
  font-size: 16px;
  line-height: 1.4;
  text-align: center;
  padding: 0 6px;
}

/* Caption defaults: no scroll unless JS caps it */
#lightbox-caption {
  overflow: hidden;         /* JS flips this to auto only when needed */
  line-height: 1.4;
}

/* Optional: nicer scrolling & padding inside the caption */
#lightbox-caption.scrolling {
  text-align: left;
  overflow-y: auto;
  padding-right: 8px;       /* room for scrollbar so text doesn't jump */
}

/* Caption link styling (scoped so it won't affect other links) */
#lightbox-caption a {
  color: #7ec8ff;                 /* light blue */
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1.5px;
}

#lightbox-caption a:visited {
  color: #9fd6ff;                 /* slightly different but still bright */
}

#lightbox-caption a:hover {
  color: #aee0ff;                 /* brighter on hover */
  text-decoration-thickness: 2px; /* a bit bolder underline */
}

#lightbox-caption a:active {
  color: #c6eaff;
}

#lightbox-caption a:focus-visible {
  outline: 2px solid #aee0ff;     /* accessible focus ring */
  outline-offset: 2px;
  border-radius: 3px;
}



/* Controls above content for clickability */
.lightbox .close,
.lightbox .prev,
.lightbox .next {
  position: absolute;
  z-index: 2;
  color: #fff;
  cursor: pointer;
  user-select: none;
}

/* X button */
.lightbox .close {
  top: 16px;
  right: 16px;
  font-size: 36px;
  line-height: 1;
  padding: 6px 10px;
  background: rgba(0,0,0,.55);
  border-radius: 6px;
}
.lightbox .close:hover { background: rgba(0,0,0,.75); }

/* Arrows */
.lightbox .prev,
.lightbox .next {
  top: 50%;
  transform: translateY(-50%);
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(0,0,0,.55);
  display: grid; place-items: center;
  font-size: 24px;
}
.lightbox .prev { left: 12px; }
.lightbox .next { right: 12px; }
.lightbox .prev:hover, .lightbox .next:hover { background: rgba(0,0,0,.75); }

@media (min-width: 641px) {
  .lightbox-stage { padding-inline: 28px; } /* larger screens */
}

/* Small screens: guarantee *no* horizontal overflow */
@media (max-width: 640px) {
  .lightbox-content { padding-inline: 16px; }
  .lightbox .lightbox-image, .lightbox .lightbox-video {
    height: auto;                     /* allow proportional scaling */
    max-height: 80vh;                 /* but never taller than viewport */
    max-width: calc(100vw - 32px);    /* never wider than viewport minus padding */
  }
  .lightbox .lightbox-youtube {
    width: min(calc(100vw - 32px), calc(80vh * (16 / 9)));
    max-width: calc(100vw - 32px);
    max-height: 80vh;
  }
  .lightbox .prev, .lightbox .next {
    width: 40px; height: 40px; font-size: 20px;
  }
}



/* Ultra-short viewports (landscape phones) */
@media (max-height: 480px) {
  .lightbox .lightbox-image { max-height: 68vh; }
}

/* Make the HTML [hidden] attribute work everywhere */
[hidden] { display: none !important; }

/* Shared icon buttons (unchanged size/looks) */
.lightbox .iconbtn {
  position: absolute;
  z-index: 3;
  width: 36px;
  height: 36px;
  border: 0;
  padding: 0;
  border-radius: 6px;
  background: rgba(0,0,0,.55);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  user-select: none;

  /* keep them clear of notches/status bars */
  top: max(16px, env(safe-area-inset-top, 0px));
}
.lightbox .iconbtn:hover { background: rgba(0,0,0,.75); }

/* Move DOWNLOAD to the top-left */
.lightbox .iconbtn.download {
  left: max(16px, env(safe-area-inset-left, 0px));
  right: auto;             /* override previous right-based rule */
}

/* Keep CLOSE (X) at the top-right */
.lightbox .iconbtn.close {
  right: max(16px, env(safe-area-inset-right, 0px));
  left: auto;
}

/* Optional tighter spacing on small screens */
@media (max-width: 640px) {
  .lightbox .iconbtn.download {
    left: max(12px, env(safe-area-inset-left, 0px));
  }
  .lightbox .iconbtn.close {
    right: max(12px, env(safe-area-inset-right, 0px));
  }
}

/* --- Small screens: park controls at the bottom --- */
@media (max-width: 640px) {
  .lightbox .prev,
  .lightbox .next {
    top: auto;                                /* stop vertical-centering */
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    transform: none;                           /* remove translateY(-50%) */
    z-index: 4;                                /* above captions/media */
  }

  .lightbox .prev {
    left: max(12px, env(safe-area-inset-left, 0px));
    right: auto;
  }

  .lightbox .next {
    right: max(12px, env(safe-area-inset-right, 0px));
    left: auto;
  }

  /* Optional: subtle gradient to improve contrast over content */
  .lightbox::after {
    content: "";
    position: absolute;
    left: 0; right: 0;
    bottom: 0;
    height: 80px;
    pointer-events: none;
    background: linear-gradient(to top, rgba(0,0,0,0.35), rgba(0,0,0,0));
  }
}
.gallery img:focus {
  outline: 3px solid rgba(2, 179, 255, 0.85);
  outline-offset: 2px;
  border-radius: 6px;
}
