/* ============================================================
   *nnika Portfolio — polaroids.css
============================================================ */

.polaroid-grid {
  margin-bottom: 2rem;
}

.polaroid-item {
  width: calc(20% - 14px);
  margin-bottom: 16px;
  transition: transform 0.25s ease;
  /* Fade-In für neu geladene Karten (Load More) — gesteuert
     über .is-visible, siehe polaroids.js. Separates opacity-only
     Timing, damit's nicht mit der Hover-transform-Transition
     oben kollidiert. */
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.4s ease;
}

.polaroid-item.is-visible {
  opacity: 1;
}

.polaroid-item img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(2px 4px 8px rgba(0, 0, 0, 0.15));
  /* dezenter Rahmen, damit der helle gescannte Polaroid-Rand sich
     optisch vom butter-gelben Hintergrund abhebt statt zu verschmelzen */
  outline: 1px solid rgba(46, 46, 48, 0.08);
  outline-offset: -1px;
}

.polaroid-item:hover {
  transform: scale(1.02) translateY(-3px);
  z-index: 2;
}

.polaroid-item:hover img {
  filter: drop-shadow(4px 6px 14px rgba(0, 0, 0, 0.22));
}

/* ------------------------------------------------------------
   KLICK-EFFEKT — kurzer "Punch" beim Antippen, bevor die
   Lightbox aufgeht. Klasse wird per JS (polaroids.js) kurz vor
   dem Öffnen gesetzt und nach der Animation wieder entfernt.
------------------------------------------------------------ */
@keyframes polaroidClickPunch {
  0%   { transform: scale(1); }
  40%  { transform: scale(0.94); }
  100% { transform: scale(1); }
}

.polaroid-item.is-clicked {
  animation: polaroidClickPunch 0.25s ease;
}


/* Load More + Back to home nebeneinander */
.polaroid-load-more {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-bottom: 4rem;
  flex-wrap: wrap;
}

.polaroid-load-more__btn {
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--linen);
  background: rgba(46, 46, 48, 0.45);
  border: none;
  border-radius: 100px;
  padding: 0.6em 1.4em;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  box-shadow: 2px 3px 8px rgba(0, 0, 0, 0.12);
}

.polaroid-load-more__btn:hover {
  background: rgba(46, 46, 48, 0.7);
  transform: translateY(-2px);
  box-shadow: 3px 5px 12px rgba(0, 0, 0, 0.2);
}

/* Gleiche Optik wie .back-to-portfolio__button (portfolio-detail.css),
   hier eigenständig definiert, da .polaroid-load-more ein eigenes
   Flex-Layout braucht statt der zentrierten Einzel-Button-Wrapper */
.polaroid-load-more__home {
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--linen);
  background: rgba(46, 46, 48, 0.45);
  padding: 0.6em 1.4em;
  border-radius: 100px;
  text-decoration: none;
  border: none;
  display: inline-block;
  box-shadow: 2px 3px 8px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.polaroid-load-more__home:hover {
  background: rgba(46, 46, 48, 0.7);
  transform: translateY(-2px);
  box-shadow: 3px 5px 12px rgba(0, 0, 0, 0.2);
}


/* ------------------------------------------------------------
   PASSWORT-GATE
   Ersetzt den Load-More-Button, bis das richtige Passwort
   eingegeben wurde (siehe polaroids.js). Gleicher schlanker,
   halbtransparenter Look wie die anderen Buttons.
------------------------------------------------------------ */
.polaroid-password-gate {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.polaroid-password-gate__input {
  font-family: var(--font-main);
  font-size: 0.85rem;
  color: var(--graphite);
  background: rgba(46, 46, 48, 0.08);
  border: 1.5px solid rgba(46, 46, 48, 0.25);
  border-radius: 100px;
  padding: 0.55em 1.2em;
  outline: none;
  transition: border-color 0.2s ease;
  width: 180px;
}

.polaroid-password-gate__input:focus {
  border-color: rgba(46, 46, 48, 0.5);
}

.polaroid-password-gate__input::placeholder {
  color: rgba(46, 46, 48, 0.45);
}

.polaroid-password-gate__submit {
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--linen);
  background: rgba(46, 46, 48, 0.45);
  border: none;
  border-radius: 100px;
  padding: 0.6em 1.4em;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  box-shadow: 2px 3px 8px rgba(0, 0, 0, 0.12);
}

.polaroid-password-gate__submit:hover {
  background: rgba(46, 46, 48, 0.7);
  transform: translateY(-2px);
  box-shadow: 3px 5px 12px rgba(0, 0, 0, 0.2);
}

.polaroid-password-gate__error {
  font-family: var(--font-main);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--rouge);
  font-style: italic;
}

.polaroid-password-gate.hidden {
  display: none;
}

/* ------------------------------------------------------------
   SHAKE-HINWEIS — kurzes Schütteln des Passwort-Felds, wenn man
   ohne gültiges Passwort auf ein Polaroid klickt (siehe
   handlePolaroidClick() in polaroids.js). Signalisiert "hier
   musst du zuerst was eingeben", ohne einen Alert/Dialog zu nutzen.
------------------------------------------------------------ */
@keyframes polaroidPasswordShake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(7px); }
  60%      { transform: translateX(-5px); }
  80%      { transform: translateX(4px); }
}

.polaroid-password-gate.is-shaking {
  animation: polaroidPasswordShake 0.4s ease;
}

.polaroid-password-gate.is-shaking .polaroid-password-gate__input {
  border-color: var(--rouge);
}

@media (prefers-reduced-motion: reduce) {
  .polaroid-password-gate.is-shaking {
    animation: none;
  }
}

/* Lightbox */
.polaroid-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.polaroid-lightbox.active {
  display: flex;
}

.polaroid-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(46, 46, 48, 0.75);
  backdrop-filter: blur(4px);
}

.polaroid-lightbox__panel {
  position: relative;
  z-index: 2;
  /* dunkel statt hell — passt besser zu den hellen Polaroid-Karten
     als Kontrast, statt mit ihnen zu verschmelzen */
  background: var(--graphite);
  border-radius: 4px;
  padding: 2rem;
  max-width: 560px;
  width: 90%;
  /* Not-Bremse: falls Bild + Meta + Button trotz Bild-Höhenlimit
     zu hoch werden (z.B. sehr niedriger Viewport), wird das Panel
     selbst scrollbar statt über den Screen hinauszuwachsen */
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: lightboxIn 0.25s ease;
}

@keyframes lightboxIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.polaroid-lightbox__close {
  position: absolute;
  top: 0.8rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--linen);
  opacity: 0.5;
  transition: opacity 0.2s ease;
}
.polaroid-lightbox__close:hover { opacity: 1; }

.polaroid-lightbox__img {
  /* Haupt-Fix: Hochformat-Polaroids wurden vorher beliebig hoch
     (nur width:100% war gesetzt), dadurch wuchs das Panel über
     den Screen hinaus und Buttons wurden abgeschnitten */
  max-width: 100%;
  max-height: 60vh;
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto;
}

.polaroid-lightbox__download {
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--linen);
  text-decoration: none;
  border: 1.5px solid var(--linen);
  border-radius: 100px;
  padding: 0.6em 1.8em;
  transition: background 0.2s ease, color 0.2s ease;
}
.polaroid-lightbox__download:hover {
  background: var(--linen);
  color: var(--graphite);
}


/* ------------------------------------------------------------
   MOBILE GRID
------------------------------------------------------------ */
@media (max-width: 768px) {
  .polaroid-item {
    width: calc(50% - 8px);
  }
}


/* ------------------------------------------------------------
   SEITEN-FADE-IN beim Laden
------------------------------------------------------------ */
@keyframes polaroidsFadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.polaroids-detail .site-header,
.polaroids-detail .detail-intro {
  opacity: 0;
  animation: polaroidsFadeInUp 0.6s ease forwards;
}

.polaroids-detail .site-header  { animation-delay: 0.05s; }
.polaroids-detail .detail-intro { animation-delay: 0.2s; }

@media (prefers-reduced-motion: reduce) {
  .polaroids-detail .site-header,
  .polaroids-detail .detail-intro {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .polaroid-item.is-clicked {
    animation: none;
  }
}


/* ------------------------------------------------------------
   FOOTER FADE-IN — wartet auf echtes Masonry-Layout-Ende
------------------------------------------------------------ */
.polaroids-detail .site-footer {
  opacity: 0;
  transition: opacity 0.5s ease;
}

.polaroids-detail .site-footer.is-visible {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .polaroids-detail .site-footer {
    transition: none;
    opacity: 1;
  }
}