/**
 * Magazin foto – primul layout: panou plută, „printuri” cu bandă/pioneză, grilă 5 coloane.
 * Scoped sub body.page-shop-foto / .smf-*
 *
 * IMPORTANT: nu folosi id="SHW" pe această pagină — în style.css, [id$="W"] aplică
 * display:flex; flex-direction:column pe orice id care se termină cu „W”, ceea ce
 * comprima grila și tăia scroll-ul împreună cu #main_content { overflow: hidden }.
 */

/* Un singur scroll: doar .smf-grid-viewport (lângă poze). Pagina nu mai derulează pe înălțime. */
html:has(body.page-shop-foto) {
  height: 100% !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  overflow: hidden !important;
}

body.page-shop-foto {
  height: 100% !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  background-color: #141a22 !important;
}

/* Navbar A0 e fixed — #main_content are padding-top; umplem înălțimea vizibilă */
body.page-shop-foto #main_wrap {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  height: auto !important;
  max-height: none !important;
  background: #141a22 !important;
}

body.page-shop-foto #main_content {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  height: auto !important;
  max-height: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* --- Panou + container (id SMF, nu SHW) --- */
#SMF.smf-main {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 auto !important;
  padding: clamp(0.35rem, 1.2vw, 0.65rem) clamp(0.2rem, 0.9vw, 0.45rem) clamp(0.35rem, 1vw, 0.5rem);
  box-sizing: border-box;
  height: auto !important;
  max-height: none !important;
  overflow: hidden !important;
  background: #141a22;
}

.smf-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  padding: 0 0.1rem;
  flex-shrink: 0;
}

body.page-shop-foto .smf-legal-note {
  margin: 0 0 0.4rem;
  padding: 0.25rem clamp(0.35rem, 1.2vw, 0.6rem);
  font-size: clamp(0.55rem, 1.05vw, 0.72rem);
  line-height: 1.35;
  color: #94a3b8;
  text-align: center;
  flex-shrink: 0;
}

body.page-shop-foto .smf-legal-note a {
  color: #5ee9f3;
  font-weight: 700;
}

.smf-title {
  margin: 0;
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: 0.02em;
  justify-self: start;
}

.smf-donate-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  padding: 0.45rem 0.9rem;
  background: linear-gradient(175deg, #5ee9f3 0%, #06b6d4 52%, #0e7490 100%);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 0.9rem;
}

.smf-donate-link:hover {
  filter: brightness(1.06);
}

.smf-back-link {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  padding: 0.45rem 0.9rem;
  background: rgba(51, 65, 85, 0.75);
  color: #e2e8f0;
  font-weight: 700;
  text-decoration: none;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.9rem;
}

.smf-back-link:hover {
  background: rgba(71, 85, 105, 0.9);
  color: #f8fafc;
}

/* Fundal plută + hârtie ușoară */
.smf-cork {
  position: relative;
  container-type: inline-size;
  container-name: smf-cork;
  --smf-gap: clamp(0.35rem, 0.9vw, 0.65rem);
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 14px;
  padding: clamp(0.45rem, 1vw, 0.75rem) clamp(0.35rem, 0.85vw, 0.55rem);
  box-sizing: border-box;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -2px 12px rgba(0, 0, 0, 0.35),
    0 12px 36px rgba(0, 0, 0, 0.4);
  background-color: #1e293b;
  background-image:
    radial-gradient(ellipse 120% 80% at 15% 20%, rgba(255, 255, 255, 0.06) 0%, transparent 45%),
    radial-gradient(ellipse 90% 70% at 85% 75%, rgba(0, 0, 0, 0.2) 0%, transparent 42%),
    repeating-linear-gradient(
      -8deg,
      transparent,
      transparent 2px,
      rgba(255, 255, 255, 0.02) 2px,
      rgba(255, 255, 255, 0.02) 3px
    ),
    linear-gradient(168deg, #334155 0%, #1e293b 48%, #0f172a 100%);
  border: 1px solid rgba(6, 182, 212, 0.15);
}

.smf-cork::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.25'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

/* Singurul scroll vertical al paginii: zona grilei în panou */
.smf-grid-viewport {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

/* Grilă: 5 coloane desktop; 3 / 2 coloane pe ecrane înguste */
.smf-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-rows: auto;
  gap: var(--smf-gap, clamp(0.45rem, 1.1vw, 0.85rem));
  align-content: start;
  align-items: start;
}

/* Sentinel încărcare progresivă (ca P2 / pt-p2-load-sentinel) */
.smf-load-sentinel {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 8px;
  flex-shrink: 0;
  pointer-events: none;
}

@media (max-width: 1024px) {
  .smf-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .smf-cork {
    --smf-gap: 0.35rem;
  }

  .smf-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* --- Print --- */
.smf-print {
  --smf-rot: 0deg;
  position: relative;
  min-width: 0;
  align-self: start;
  transform: rotate(var(--smf-rot));
  transition: transform 0.25s ease, filter 0.25s ease;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.22));
}

.smf-print:nth-child(5n + 1) {
  --smf-rot: -1.4deg;
}
.smf-print:nth-child(5n + 2) {
  --smf-rot: 0.9deg;
}
.smf-print:nth-child(5n + 3) {
  --smf-rot: -0.6deg;
}
.smf-print:nth-child(5n + 4) {
  --smf-rot: 1.2deg;
}
.smf-print:nth-child(5n) {
  --smf-rot: -0.9deg;
}

@media (max-width: 560px) {
  .smf-print {
    --smf-rot: 0deg !important;
  }
}

.smf-print:hover {
  z-index: 2;
  transform: rotate(var(--smf-rot)) translateY(-3px);
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.28));
}

/* Casetă demo: link # sau buton – același aspect */
a.smf-print__link,
button.smf-print__link {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  font: inherit;
  text-align: inherit;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border-radius: 4px;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
}

.smf-print__link:focus-visible {
  outline: 2px solid rgba(6, 182, 212, 0.65);
  outline-offset: 3px;
}

/* Margine „hârtie”: imaginea merge stânga–dreapta la muchie; padding doar sus/jos + pe bara meta */
.smf-print__mat {
  position: relative;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
  padding: 0;
  padding-top: clamp(0.38rem, 0.9vw, 0.5rem);
  padding-bottom: clamp(0.2rem, 0.45vw, 0.3rem);
  border-radius: 3px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 0 0 1px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

/* Pioneză discretă */
.smf-print__mat::after {
  content: "";
  position: absolute;
  z-index: 3;
  top: 0.08rem;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff7043, #bf360c 55%, #5d4037);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.25) inset;
  pointer-events: none;
}

/* Zona foto – lățime completă în casetă (fără „margini” laterale pe imagine) */
.smf-print__photo {
  position: relative;
  overflow: hidden;
  border-radius: 0;
  width: 100%;
  aspect-ratio: 4 / 3;
  height: auto;
  background: #334155;
  flex-shrink: 0;
}

.smf-print__collected-badge {
  position: absolute;
  top: 0.32rem;
  left: 0.32rem;
  z-index: 5;
  display: none;
  align-items: center;
  max-width: calc(100% - 0.64rem);
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.88);
  color: #bbf7d0;
  font-size: clamp(0.56rem, 1.1vw, 0.64rem);
  font-weight: 800;
  line-height: 1.15;
  border: 1px solid rgba(52, 211, 153, 0.35);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.smf-print__photo.is-collected-visible .smf-print__collected-badge {
  display: inline-flex;
}

.smf-print__photo {
  cursor: pointer;
}

/* Peste img { max-width:100%; height:auto } din style.css */
body.page-shop-foto .smf-print__photo img {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover !important;
  object-position: center !important;
  display: block !important;
  transition: transform 0.4s ease;
}

.smf-print:hover .smf-print__photo img {
  transform: scale(1.07);
}

/* Bară info: multiplicator | nume | coș */
.smf-print__meta {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) max-content;
  align-items: center;
  gap: clamp(0.06rem, 0.55vw, 0.18rem);
  margin-top: 0.22rem;
  padding: 0 clamp(0.14rem, 0.42vw, 0.26rem);
  min-height: 1.2rem;
  font-size: clamp(0.52rem, 1.08vw, 0.62rem);
  line-height: 1.15;
}

.smf-print__name {
  grid-column: 2;
  min-width: 0;
  font-style: normal;
  font-weight: 800;
  font-size: clamp(0.66rem, 1.55vw, 0.88rem);
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.smf-print__multiplier--bar {
  grid-column: 1;
}

.smf-print__site-cart {
  grid-column: 3;
}

/* Multiplicator și coș integrate în meta */
.smf-print__multiplier {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  justify-self: start;
  min-height: 0;
  font-size: inherit;
}

.smf-print__multiplier--bar {
  padding: 1px 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(96, 125, 139, 0.22);
  max-width: 100%;
}

/* Coș I Love în bară */
.smf-print__site-cart {
  position: relative;
  justify-self: end;
  z-index: 2;
  margin: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-sizing: border-box;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Forțare față de style.css (inputs / buttons globale) */
body.page-shop-foto .smf-print__mult-btn {
  width: 14px !important;
  height: 14px !important;
  min-width: 14px !important;
  max-width: 14px !important;
  min-height: 14px !important;
  padding: 0 !important;
  line-height: 1 !important;
  border-radius: 3px !important;
  background: rgba(15, 23, 42, 0.75) !important;
  color: #e2e8f0 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  font-weight: 800 !important;
  font-size: 9px !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  font-family: inherit !important;
  box-shadow: none !important;
}

body.page-shop-foto .smf-print__mult-btn:active {
  background: rgba(30, 41, 59, 0.95) !important;
}

body.page-shop-foto .smf-print__mult-input {
  width: 24px !important;
  max-width: 24px !important;
  min-width: 0 !important;
  height: 14px !important;
  padding: 0 !important;
  margin: 0 !important;
  line-height: 1 !important;
  box-sizing: border-box !important;
  border: 1px solid rgba(96, 125, 139, 0.38) !important;
  border-radius: 3px !important;
  text-align: center !important;
  font-size: 8px !important;
  font-weight: 800 !important;
  font-family: inherit !important;
  color: #f1f5f9 !important;
  background: rgba(15, 23, 42, 0.85) !important;
  vertical-align: middle !important;
  -moz-appearance: textfield !important;
  appearance: textfield !important;
}

body.page-shop-foto .smf-print__mult-input::-webkit-outer-spin-button,
body.page-shop-foto .smf-print__mult-input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

body.page-shop-foto .smf-print__site-cart {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  max-width: 18px !important;
  min-height: 18px !important;
  padding: 0 !important;
  line-height: 1 !important;
  background: rgba(15, 23, 42, 0.9) !important;
  color: #5ee9f3 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  font-size: 11px !important;
  font-weight: 400 !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18) !important;
}

body.page-shop-foto .smf-print__site-cart.is-active {
  background: linear-gradient(175deg, #5ee9f3 0%, #06b6d4 52%, #0e7490 100%) !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

@media (prefers-reduced-motion: reduce) {
  .smf-print,
  .smf-print__photo img {
    transition: none;
  }
  .smf-print:hover {
    transform: rotate(var(--smf-rot));
  }
  .smf-print:hover .smf-print__photo img {
    transform: none;
  }
}
