/* Theme-agnostic structural CSS for the gallery UI: masonry grid, lightbox,
   slideshow, toolbar, hero layout. All colors/fonts come from custom
   properties defined per-theme in themes/<theme-id>.css -  this file has no
   raw color values so it renders identically under every theme. */

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

[data-gallery-root] {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  height: 100vh;
  min-height: 560px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero__overlay {
  position: absolute;
  inset: 0;
  background: var(--hero-overlay);
}

.hero__credit {
  position: absolute;
  top: 40px;
  left: 38px;
  margin: 0;
  color: var(--hero-fg);
  font-family: var(--label);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 1.8px;
  line-height: 15px;
  text-transform: uppercase;
}

.hero__content {
  position: relative;
  z-index: 1;
  padding-left: 38px;
  max-width: 700px;
}

.hero__title {
  font-family: var(--serif);
  font-weight: 300;
  color: var(--hero-fg);
  font-size: clamp(34px, 5.2vw, 64px);
  line-height: 1;
  letter-spacing: -0.64px;
  margin: 0 0 18px;
}

.hero__date {
  color: var(--hero-fg);
  font-family: var(--label);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 1.65px;
  text-transform: uppercase;
  margin: 0;
}

.hero__cta {
  position: absolute;
  left: 38px;
  bottom: 60px;
  z-index: 1;
  color: var(--hero-fg);
  text-decoration: none;
  font-family: var(--label);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.65px;
  text-transform: uppercase;
  line-height: 16px;
  border: 1px solid var(--hero-cta-border);
  padding: 12px 24px;
  transition: background .25s ease, color .25s ease;
}

.hero__cta:hover {
  background: var(--hero-fg);
  color: var(--ink);
}

/* ---------- Toolbar ---------- */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 40px;
  background: var(--toolbar-bg);
  border-bottom: 1px solid var(--toolbar-border);
}

.toolbar__title h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 19.8px;
  letter-spacing: 0.2px;
  color: var(--ink);
}

.toolbar__title span {
  font-family: var(--label);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
}

.toolbar__actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.toolbar__icon {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--ink);
}

.toolbar__icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toolbar__icon polygon {
  fill: currentColor;
  stroke: none;
}

.toolbar__icon.is-active svg,
.lightbox__icon.is-active svg {
  fill: var(--ink);
}

.toolbar__hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink);
  padding: 4px;
}

.toolbar__hamburger svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}

.mobile-menu {
  display: none;
  flex-direction: column;
  position: sticky;
  top: 78px;
  z-index: 9;
  background: var(--toolbar-bg);
  border-bottom: 1px solid var(--toolbar-border);
  box-shadow: 0 8px 20px rgba(0,0,0,.06);
}

.mobile-menu.is-open { display: flex; }

.mobile-menu__link {
  background: none;
  border: none;
  border-top: 1px solid var(--toolbar-border);
  text-align: left;
  padding: 14px 24px;
  font-family: var(--label);
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}

@media (max-width: 780px) {
  .toolbar__actions--desktop { display: none; }
  .toolbar__hamburger { display: block; }
}

/* ---------- Gallery grid (true brick masonry, JS-positioned) ---------- */
.gallery {
  position: relative;
  padding: 14px;
  /* Breathing room between the sticky toolbar and the first row of photos.
     Tiles are absolutely positioned from the padding-box top (top:0), so
     padding-top wouldn't push them down - margin on the container is what
     actually creates the gap. */
  margin-top: 16px;
}

.gallery__error {
  text-align: center;
  padding: 80px 24px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 15px;
}

.gallery__error a {
  color: var(--ink);
  text-decoration: underline;
}

.gallery__item {
  position: absolute;
  box-sizing: border-box;
  padding: 3px;
  cursor: pointer;
  transition: top .25s ease, left .25s ease;
}

.gallery__item__inner {
  overflow: hidden;
  width: 100%;
  height: 100%;
  background: var(--gallery-placeholder-bg);
}

.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: transform .4s ease, opacity .35s ease;
}

.gallery__item img[src] {
  opacity: 1;
}

.gallery__item:hover img {
  transform: scale(1.03);
}

@media (max-width: 640px) {
  .hero__content, .hero__credit, .hero__cta { padding-left: 24px; left: 24px; }
  .toolbar { padding: 14px 20px; }
  .hero__title { font-size: clamp(44px, 10vw, 60px); }
  .hero__date { font-size: 13px; }
  .hero { justify-content: flex-start; }
  .hero__content { margin-top: 15vh; }
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 40px 0;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* ---------- Lightbox (single-photo view) ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: var(--lightbox-bg);
  display: none;
  flex-direction: column;
  z-index: 100;
  touch-action: pinch-zoom;
  overscroll-behavior: none;
}

.lightbox.is-open { display: flex; }

.lightbox__bar {
  height: 78px;
  flex: 0 0 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--lightbox-border);
}

.lightbox__back {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 28px;
  color: var(--ink);
  line-height: 1;
}

.lightbox__bar-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.lightbox__icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink);
}

.lightbox__icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lightbox__icon polygon { fill: currentColor; stroke: none; }

.lightbox__stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px 90px;
  min-height: 0;
}

.lightbox__img {
  max-width: 100%;
  max-height: calc(100vh - 78px - 80px);
  object-fit: contain;
}

.lightbox__caption {
  margin: 0;
  font-family: var(--label);
  font-size: 12.5px;
  color: var(--lightbox-caption);
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--ink);
  cursor: pointer;
  font-size: 40px;
  line-height: 1;
  padding: 10px 16px;
}

.lightbox__nav--prev { left: 12px; }
.lightbox__nav--next { right: 12px; }

@media (max-width: 640px) {
  .lightbox__stage { padding: 16px 44px; }
  .lightbox__nav { font-size: 30px; padding: 8px 6px; }
  .lightbox__nav--prev { left: 2px; }
  .lightbox__nav--next { right: 2px; }
}

/* ---------- Slideshow ---------- */
.slideshow {
  position: fixed;
  inset: 0;
  background: var(--slideshow-bg);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  touch-action: pinch-zoom;
  overscroll-behavior: none;
}

.slideshow.is-open { display: flex; }

.slideshow__img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  animation: slideshow-fade .6s ease;
}

@keyframes slideshow-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.slideshow__exit,
.slideshow__pause {
  position: absolute;
  background: var(--slideshow-control-bg);
  border: none;
  color: var(--slideshow-control-fg);
  cursor: pointer;
  line-height: 1;
}

.slideshow__exit {
  top: 24px;
  right: 32px;
  font-size: 26px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.slideshow__pause {
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  padding: 12px 16px;
  border-radius: 20px;
}

/* ---------- Login (private gallery password gate) ---------- */
.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Inverted from the theme's normal ink-on-paper for a moody "enter
     password" screen -  correct for themes where --ink is the darker of the
     pair. Dark-mode themes (light --ink text on dark --paper background)
     need the opposite swap to still land on a dark screen here, so they
     override these two custom properties in their own [data-theme] block;
     everything else falls back to the plain ink/paper swap. */
  background: var(--login-bg, var(--ink));
  font-family: var(--serif), Georgia, serif;
  color: var(--login-fg, var(--paper));
  padding: 24px;
}

.login__card { width: 100%; max-width: 360px; text-align: center; }

.login__title {
  font-weight: 300;
  font-size: 32px;
  margin: 0 0 8px;
  font-family: var(--serif);
}

.login__sub {
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--login-fg, var(--paper)) 60%, transparent);
  margin: 0 0 32px;
  font-family: var(--label);
}

.login__input {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  background: color-mix(in srgb, var(--login-fg, var(--paper)) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--login-fg, var(--paper)) 30%, transparent);
  color: var(--login-fg, var(--paper));
  border-radius: 2px;
  margin-bottom: 16px;
  font-family: var(--sans);
}

.login__input::placeholder { color: color-mix(in srgb, var(--login-fg, var(--paper)) 40%, transparent); }

.login__submit {
  width: 100%;
  padding: 14px;
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--login-fg, var(--paper)) 70%, transparent);
  color: var(--login-fg, var(--paper));
  cursor: pointer;
  font-family: var(--label);
  transition: background .25s ease, color .25s ease;
}

.login__submit:hover { background: var(--login-fg, var(--paper)); color: var(--login-bg, var(--ink)); }

.login__error { color: #ff8080; font-size: 13px; margin: -8px 0 16px; font-family: var(--sans); }

/* ---------- Download modal (choose size, then save straight to device -
   no email step, no third-party destinations) ---------- */
.download-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 150;
  padding: 24px;
}

.download-modal.is-open { display: flex; }

.download-modal__dialog {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--paper);
  color: var(--ink);
  border-radius: 4px;
  padding: 32px 28px 28px;
}

.download-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
}

.download-modal__title {
  font-weight: 300;
  font-size: 22px;
  margin: 0 0 22px;
  font-family: var(--serif);
}

.download-modal__label {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--label);
  margin: 0 0 10px;
}

.download-modal__option {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 0;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 15px;
}

.download-modal__option input { accent-color: var(--ink); }

.download-modal__option-sub {
  font-size: 12px;
  color: var(--muted);
}

.download-modal__start {
  width: 100%;
  margin-top: 22px;
  padding: 14px;
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--paper);
  border: none;
  cursor: pointer;
  font-family: var(--label);
  transition: opacity .2s ease;
}

.download-modal__start:hover { opacity: 0.85; }
.download-modal__start:disabled { opacity: 0.4; cursor: default; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%) translateY(20px);
  background: var(--toast-bg);
  color: var(--toast-fg);
  font-family: var(--sans);
  font-size: 13px;
  padding: 12px 22px;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 300;
  max-width: 90vw;
  text-align: center;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
