/* Crezzio Polaroid Menu PRO */

.polaroid-menu-panel *,
.polaroid-menu-panel *::before,
.polaroid-menu-panel *::after {
  box-sizing: border-box;
}

/* Toggle button */
.polaroid-menu-toggle {
  position: fixed;
  top: 32px;
  right: 44px;
  background: none;
  border: 1px solid rgba(245, 240, 232, 0.3);
  border-radius: 0;
  padding: 10px 22px;
  cursor: pointer;
  z-index: 9999999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
  box-shadow: none;
  backdrop-filter: none;
  font-family: 'Space Mono', 'Courier New', monospace;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(245, 240, 232, 0.85);
  mix-blend-mode: difference;
}

.polaroid-menu-toggle span { display: none; }

.polaroid-menu-toggle::after {
  content: 'MENU';
  display: block;
  font-family: 'Space Mono', 'Courier New', monospace;
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  line-height: 1;
}

.polaroid-menu-toggle.active {
  background: rgba(245, 240, 232, 0.95);
  color: #080808;
  border-color: rgba(245, 240, 232, 0.95);
}

.polaroid-menu-toggle.active::after {
  content: 'CLOSE';
  color: #080808;
}

.polaroid-menu-toggle:hover:not(.active) {
  background: rgba(245, 240, 232, 0.95);
  color: #080808;
  border-color: rgba(245, 240, 232, 0.95);
  transform: none;
  box-shadow: none;
}

/* Overlay */
.polaroid-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 8, 0.97);
  z-index: 9999998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.polaroid-menu-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* Panel */
.polaroid-menu-panel {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 8, 8, 0.98);
  border-left: none;
  box-shadow: none;
  z-index: 9999999;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}
.polaroid-menu-overlay.is-open .polaroid-menu-panel {
  transform: translateY(0);
}

/* Top hairline */
.polaroid-menu-panel::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(245,240,232,0.1), transparent);
  pointer-events: none;
}

/* Close button */
.polaroid-menu-close {
  position: absolute;
  top: 28px;
  right: 44px;
  z-index: 10;
  width: auto;
  height: auto;
  border: 1px solid rgba(245, 240, 232, 0.25);
  background: none;
  border-radius: 0;
  color: rgba(245, 240, 232, 0.6);
  font-family: 'Space Mono', 'Courier New', monospace;
  font-size: 9px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 8px 16px;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.polaroid-menu-close:hover {
  background: rgba(245, 240, 232, 0.95);
  color: #080808;
  border-color: rgba(245, 240, 232, 0.95);
  transform: none;
}

/* Fullscreen grid */
.polaroid-menu-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, auto);
  align-items: center;
  justify-items: center;
  column-gap: clamp(10px, 1.2vw, 18px);
  row-gap: clamp(24px, 3vh, 40px);
  padding: clamp(48px, 6vh, 72px) clamp(40px, 5vw, 72px) clamp(28px, 3.5vh, 48px);
  z-index: 1;
  width: 100%;
  height: 100vh;
  max-width: 100%;
  box-sizing: border-box;
}

/* Hovered card stays on top */
.polaroid-card-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  animation: polaroid-card-enter 0.55s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.polaroid-card-wrap:hover { z-index: 10; }

.polaroid-menu-overlay.is-open .polaroid-card-wrap:nth-child(1) { animation-delay: 0.06s; }
.polaroid-menu-overlay.is-open .polaroid-card-wrap:nth-child(2) { animation-delay: 0.12s; }
.polaroid-menu-overlay.is-open .polaroid-card-wrap:nth-child(3) { animation-delay: 0.18s; }
.polaroid-menu-overlay.is-open .polaroid-card-wrap:nth-child(4) { animation-delay: 0.24s; }
.polaroid-menu-overlay.is-open .polaroid-card-wrap:nth-child(5) { animation-delay: 0.30s; }
.polaroid-menu-overlay.is-open .polaroid-card-wrap:nth-child(6) { animation-delay: 0.36s; }
.polaroid-menu-overlay.is-open .polaroid-card-wrap:nth-child(n+7) { animation-delay: 0.42s; }

@keyframes polaroid-card-enter {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Tilted polaroid */

.tilted-polaroid {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  text-decoration: none;
  color: inherit;
  perspective: 900px;
  position: relative;
  width: 100%;
  height: auto;
  cursor: pointer;
}

.tilted-polaroid-inner {
  position: relative;
  width: 100%;
  height: auto;
  max-width: 100%;
  aspect-ratio: 4 / 3;
  transform-style: preserve-3d;
  will-change: transform;
}

/* Frame */
.tilted-polaroid-frame {
  position: relative;
  width: 100%;
  height: 100%;
  background: #0d0d0d;
  padding: 12px 12px 0;
  padding-bottom: 56px;
  border-radius: 2px;
  box-shadow:
    0 0 0 1px rgba(245, 240, 232, 0.07),
    2px 4px 16px rgba(0, 0, 0, 0.5),
    4px 12px 36px rgba(0, 0, 0, 0.6),
    6px 20px 56px rgba(0, 0, 0, 0.4);
  transition: box-shadow 0.5s ease;
}

.tilted-polaroid:hover .tilted-polaroid-frame {
  box-shadow:
    0 0 0 1px rgba(245, 240, 232, 0.15),
    4px 16px 40px rgba(0, 0, 0, 0.65),
    8px 32px 72px rgba(0, 0, 0, 0.75),
    14px 48px 96px rgba(0, 0, 0, 0.5);
}

.tilted-polaroid-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 2px;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* Image */
.tilted-polaroid-image {
  position: relative;
  width: 100%;
  height: 100%;
  background: #111;
  border-radius: 1px;
  overflow: hidden;
  max-height: 100vh;
}

.tilted-polaroid-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: contrast(1.08) saturate(0.8) brightness(0.88);
  transition: filter 0.5s ease;
}

.tilted-polaroid:hover .tilted-polaroid-image img {
  filter: contrast(1.1) saturate(0.95) brightness(1);
}

.tilted-polaroid-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  background: #111;
}

.tilted-polaroid-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at center, transparent 55%, rgba(0,0,0,0.5) 100%),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 300 300' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='4' result='noise'/%3E%3CfeColorMatrix in='noise' type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23grain)' opacity='0.12'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
  pointer-events: none;
  opacity: 0.9;
}

/* Caption */
.tilted-polaroid-caption {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  min-height: 54px;
  max-height: 56px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', 'Space Mono', sans-serif;
  font-size: clamp(1.1rem, 1.6vw, 1.6rem);
  font-weight: 400;
  color: rgba(245, 240, 232, 0.85);
  text-align: center;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  overflow: hidden;
  max-height: 100vh;
  padding: 0 8px;
  overflow-wrap: break-word;
  word-break: normal;
  box-sizing: border-box;
}

.tilted-polaroid-caption-text {
  display: block;
  max-width: 100%;
  min-width: 0;
}

/* Mobile */

@media (max-width: 768px) {
  .polaroid-menu-toggle {
    top: 20px;
    right: 24px;
    padding: 9px 18px;
    font-size: 9px;
  }

  .polaroid-menu-panel {
    transform: translateY(100%);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    align-items: flex-start;
    padding: 0;
  }

  .polaroid-menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
    grid-auto-rows: auto;
    height: auto;
    gap: 14px;
    row-gap: 18px;
    padding: 80px 20px 40px 20px;
    align-content: center;
    justify-items: stretch;
    width: 100%;
    min-height: 100vh;
    box-sizing: border-box;
  }

  .polaroid-card-wrap {
    min-width: 35%;
    min-height: 0;
    width: 100%;
    height: auto;
  }

  .tilted-polaroid {
    display: block;
    width: 100%;
    max-width: 100%;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    writing-mode: horizontal-tb;
    -webkit-writing-mode: horizontal-tb;
  }

  .tilted-polaroid-inner {
    position: relative;
    width: 100%;
    padding-bottom: 128.571%;
    height: 0;
    overflow: hidden;
  max-height: 100vh;
    transform: none !important;
    -webkit-transform: none !important;
  }

  .tilted-polaroid-frame {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    padding: 8px 8px 0;
    padding-bottom: 44px;
    box-sizing: border-box;
  }

  .tilted-polaroid-caption {
    position: absolute;
    left: 6px; right: 6px; bottom: 6px;
    min-height: 36px;
    max-height: 42px;
    font-size: 0.9rem;
    writing-mode: horizontal-tb;
    -webkit-writing-mode: horizontal-tb;
    text-orientation: mixed;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
  }

  .tilted-polaroid-caption-text {
    display: block;
    max-width: 100%;
    writing-mode: horizontal-tb;
    -webkit-writing-mode: horizontal-tb;
  }

  .polaroid-menu-close {
    top: 20px;
    right: 24px;
    font-size: 8px;
    padding: 7px 14px;
  }
}

@media (max-width: 480px) {
  .polaroid-menu-grid {
    padding: 72px 16px 36px 16px;
    gap: 12px;
    row-gap: 14px;
  }

  .polaroid-card-wrap { min-width: 35%; }

  .tilted-polaroid-frame {
    padding: 8px 8px 0;
    padding-bottom: 40px;
  }

  .tilted-polaroid-caption {
    font-size: 0.82rem;
    min-height: 32px;
    max-height: 38px;
  }
}


.crezzio-plugin-home-link {
  position: fixed;
  top: 28px;
  left: 44px;
  z-index: 9999999;
  display: block;
  color: #f5f0e8;
  text-decoration: none;
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  mix-blend-mode: difference;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.crezzio-plugin-home-link:hover,
.crezzio-plugin-home-link:focus {
  color: #f5f0e8;
  text-decoration: none;
  opacity: 0.72;
  outline: none;
}

@media (max-width: 768px) {
  .crezzio-plugin-home-link {
    top: 20px;
    left: 24px;
    font-size: 20px;
  }
}
