/*
 * Dreampaint Core – Frontend (theme-unabhängig).
 * Farben, Schatten und Abstände kommen aus eigenen --dpc-*-Variablen. Theme-Werte
 * werden nur als Vorschlag übernommen, mit festem Rückfallwert.
 * Geringe Spezifität (:where), damit Themes verfeinern können.
 */

:where(.dpc-galerie, .dpc-werke, .dpc-shop, .dpc-lightbox, .dpc-hinweis) {
	--dpc-akzent: var(--wp--preset--color--accent, #B84F2A);
	--dpc-text: var(--wp--preset--color--contrast, currentColor);
	--dpc-grund: var(--wp--preset--color--base, #FAF7F2);
	--dpc-passepartout: #FFFFFF;
	--dpc-linie: rgba(36, 33, 43, .18);
	--dpc-schatten: 0 1px 2px rgba(20, 16, 12, .10), 0 14px 32px -12px rgba(20, 16, 12, .35);
	--dpc-schnur: #8B7D6B;
	--dpc-radius: 4px;
}
html.dp-dark :where(.dpc-galerie, .dpc-werke, .dpc-shop) {
	--dpc-passepartout: #ECE7DE;
	--dpc-linie: rgba(255, 255, 255, .22);
	--dpc-schatten: 0 1px 2px rgba(0, 0, 0, .4), 0 16px 34px -12px rgba(0, 0, 0, .7);
	--dpc-schnur: #B3A58F;
}

.dpc-hinweis { padding: .8em 1em; border: 1px dashed var(--dpc-linie); border-radius: var(--dpc-radius); font-size: .95em; }

/* ---------- Werk-Galerie: Grundgerüst ---------- */
.dpc-galerie { --dpc-gap: clamp(1rem, 2.4vw, 1.75rem); --dpc-spalten: 3; margin-block: 2rem; }
.dpc-galerie.dpc-abstand-eng { --dpc-gap: .6rem; }
.dpc-galerie.dpc-abstand-luftig { --dpc-gap: clamp(1.75rem, 4vw, 3.25rem); }
.dpc-galerie.dpc-spalten-2 { --dpc-spalten: 2; }
.dpc-galerie.dpc-spalten-4 { --dpc-spalten: 4; }

.dpc-galerie .dpc-galerie-liste { list-style: none; margin: 0; padding: 0; }
.dpc-galerie .dpc-werk { margin: 0; padding: 0; }
.dpc-galerie .dpc-figur { margin: 0; position: relative; display: flex; flex-direction: column; align-items: center; }
.dpc-galerie .dpc-bild { box-sizing: border-box; display: block; line-height: 0; max-width: 100%; color: inherit; text-decoration: none; cursor: zoom-in; box-shadow: var(--dpc-schatten); transition: transform .35s ease, box-shadow .35s ease; }
.dpc-galerie .dpc-bild:hover { transform: translateY(-3px); }
.dpc-galerie .dpc-bild:focus-visible { outline: 3px solid var(--dpc-akzent); outline-offset: 4px; }
.dpc-galerie .dpc-img { display: block; width: 100%; height: auto; max-width: 100%; margin: 0; border-radius: 0; }
.dpc-galerie .dpc-titel { margin: .7em 0 0; text-align: center; font-family: inherit; font-size: .95em; line-height: 1.35; opacity: .85; }

/* 1 · Galerie-Wand (Masonry, unbeschnitten) */
.dpc-layout-wand .dpc-galerie-liste { columns: var(--dpc-spalten) 220px; column-gap: var(--dpc-gap); }
.dpc-layout-wand .dpc-werk { break-inside: avoid; margin-bottom: var(--dpc-gap); }
.dpc-layout-wand .dpc-bild { width: 100%; }

/* 2 · Keilrahmen: Leinwand mit sichtbarer Kante, leicht unterschiedlich gehängt */
.dpc-layout-keilrahmen .dpc-galerie-liste { display: grid; grid-template-columns: repeat(var(--dpc-spalten), minmax(0, 1fr)); gap: calc(var(--dpc-gap) * 1.6) var(--dpc-gap); align-items: center; }
.dpc-layout-keilrahmen .dpc-bild {
	box-shadow:
		1px 1px 0 rgba(0, 0, 0, .25),
		2px 2px 0 #CFC6B6, 3px 3px 0 #C7BDAB, 4px 4px 0 #BEB39F, 5px 5px 0 rgba(0, 0, 0, .25),
		14px 20px 28px -10px rgba(20, 16, 12, .45);
}
.dpc-layout-keilrahmen .dpc-werk:nth-child(3n+1) .dpc-bild { transform: rotate(-.6deg); }
.dpc-layout-keilrahmen .dpc-werk:nth-child(3n+2) .dpc-bild { transform: translateY(10px) rotate(.4deg); }
.dpc-layout-keilrahmen .dpc-werk:nth-child(3n) .dpc-bild { transform: translateY(-6px) rotate(-.2deg); }
.dpc-layout-keilrahmen .dpc-werk .dpc-bild:hover { transform: translateY(-4px) rotate(0); }

/* 3 · Salon-Hängung: dicht an dicht, erstes Bild groß */
.dpc-layout-salon .dpc-galerie-liste { display: grid; grid-template-columns: repeat(calc(var(--dpc-spalten) + 1), minmax(0, 1fr)); grid-auto-flow: dense; gap: var(--dpc-gap); align-items: center; }
.dpc-layout-salon .dpc-werk:first-child { grid-column: span 2; grid-row: span 2; }
.dpc-layout-salon .dpc-werk:nth-child(5n+4) { grid-column: span 2; }

/* 4 · Großes Einzelbild, darunter Detailbilder als Reihe */
.dpc-layout-einzel .dpc-galerie-liste { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--dpc-gap); }
.dpc-layout-einzel .dpc-werk { flex: 0 1 calc((100% - 3 * var(--dpc-gap)) / 4); }
.dpc-layout-einzel .dpc-werk:first-child { flex: 1 1 100%; margin-bottom: var(--dpc-gap); }
.dpc-layout-einzel .dpc-werk:first-child .dpc-bild { max-width: min(100%, 1100px); }
.dpc-layout-einzel .dpc-werk:first-child .dpc-img { max-height: 85vh; width: auto; }

/* 5 · Bildband: horizontal wischbar (Scroll-Snap) */
.dpc-layout-band .dpc-galerie-liste { display: flex; gap: var(--dpc-gap); overflow-x: auto; scroll-snap-type: x mandatory; padding: 12px 4px 26px; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.dpc-layout-band .dpc-werk { flex: 0 0 auto; scroll-snap-align: center; }
.dpc-galerie.dpc-layout-band .dpc-img { height: clamp(220px, 42vw, 440px) !important; width: auto !important; max-width: none !important; }
.dpc-galerie.dpc-layout-band .dpc-bild { max-width: none; }
.dpc-layout-band .dpc-galerie-liste::-webkit-scrollbar { height: 8px; }
.dpc-layout-band .dpc-galerie-liste::-webkit-scrollbar-thumb { background: var(--dpc-linie); border-radius: 4px; }

/* ---------- Rahmen ---------- */
.dpc-rahmen-passepartout .dpc-bild { background: var(--dpc-passepartout); padding: clamp(10px, 6%, 30px); box-shadow: 0 0 0 1px rgba(0, 0, 0, .06), var(--dpc-schatten); }
.dpc-rahmen-passepartout .dpc-img { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1), 0 0 0 1px rgba(0, 0, 0, .12); }
.dpc-rahmen-linie .dpc-bild { padding: 7px; border: 1px solid var(--dpc-linie); box-shadow: none; }
.dpc-rahmen-nuss .dpc-bild,
.dpc-rahmen-eiche .dpc-bild,
.dpc-rahmen-gold .dpc-bild { border: clamp(9px, 1.6vw, 16px) solid transparent; border-image-slice: 1; }
.dpc-rahmen-nuss .dpc-bild { border-image-source: linear-gradient(135deg, #3E2716, #6E4A2E 22%, #4A2F1B 45%, #7A5535 66%, #3A2414); }
.dpc-rahmen-eiche .dpc-bild { border-image-source: linear-gradient(135deg, #8A6436, #C49A63 25%, #9C7342 50%, #CFA772 72%, #7E5A30); }
.dpc-rahmen-gold .dpc-bild { border-image-source: linear-gradient(135deg, #7A5A16, #E4C46A 20%, #A07C26 42%, #F3DD92 60%, #8C6A1E 82%, #D2B058); }
.dpc-rahmen-nuss .dpc-img,
.dpc-rahmen-eiche .dpc-img,
.dpc-rahmen-gold .dpc-img { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .3); outline: 1px solid rgba(0, 0, 0, .25); outline-offset: -1px; }
/* Keilrahmen-Kante passt nicht zu einem Rahmen: dann nur Schatten. */
.dpc-layout-keilrahmen:not(.dpc-rahmen-ohne) .dpc-bild { box-shadow: var(--dpc-schatten); }

/* An der Schnur hängend */
.dpc-haengen .dpc-werk { padding-top: 46px; }
.dpc-haengen .dpc-figur::before {
	content: ""; position: absolute; top: -40px; left: 50%; width: 46%; height: 40px; transform: translateX(-50%); pointer-events: none;
	background:
		linear-gradient(to top right, transparent calc(50% - .75px), var(--dpc-schnur) calc(50% - .75px), var(--dpc-schnur) calc(50% + .75px), transparent calc(50% + .75px)) left / 50% 100% no-repeat,
		linear-gradient(to top left, transparent calc(50% - .75px), var(--dpc-schnur) calc(50% - .75px), var(--dpc-schnur) calc(50% + .75px), transparent calc(50% + .75px)) right / 50% 100% no-repeat;
}
.dpc-haengen .dpc-figur::after { content: ""; position: absolute; top: -45px; left: 50%; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #D9D2C5, #6B6358); box-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.dpc-haengen.dpc-layout-band .dpc-werk { padding-top: 46px; }

/* Einblenden (nur für Elemente, die beim Laden noch nicht sichtbar sind) */
.dpc-reveal.dpc-wartet { opacity: 0; transform: translateY(18px); }
.dpc-reveal.dpc-in { opacity: 1; transform: none; transition: opacity .7s ease, transform .7s ease; transition-delay: calc(min(var(--dpc-i, 0), 6) * 60ms); }
@media (prefers-reduced-motion: reduce) {
	.dpc-reveal.dpc-wartet { opacity: 1; transform: none; }
	.dpc-galerie .dpc-bild, .dpc-reveal.dpc-in { transition: none; }
}

@media (max-width: 781px) {
	.dpc-layout-keilrahmen .dpc-galerie-liste,
	.dpc-layout-salon .dpc-galerie-liste { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.dpc-layout-salon .dpc-werk:nth-child(5n+4) { grid-column: auto; }
	.dpc-layout-einzel .dpc-werk { flex-basis: calc((100% - 2 * var(--dpc-gap)) / 3); }
}
@media (max-width: 520px) {
	.dpc-layout-keilrahmen .dpc-galerie-liste { grid-template-columns: minmax(0, 1fr); }
	.dpc-layout-salon .dpc-werk:first-child { grid-column: span 2; grid-row: auto; }
}

/* ---------- Werke-Wand (Grund-Optik, Themes dürfen verfeinern) ---------- */
:where(.dpc-werke) { margin-block: 1.5rem; }
:where(.dpc-wall) ul.products { display: block !important; columns: 3 240px; column-gap: clamp(1.25rem, 3vw, 2.25rem); margin: 0 !important; padding: 0 !important; list-style: none; }
:where(.dpc-wall, .dpc-shop) ul.products::before,
:where(.dpc-wall, .dpc-shop) ul.products::after { display: none !important; }
:where(.dpc-wall) ul.products li.product { float: none !important; width: auto !important; margin: 0 0 clamp(1.25rem, 3vw, 2.25rem) !important; padding: 0 !important; break-inside: avoid; text-align: center; }
:where(.dpc-wall) ul.products li.product[hidden] { display: none !important; }
:where(.dpc-wall) li.product a.woocommerce-LoopProduct-link { display: block; color: inherit; text-decoration: none; }
:where(.dpc-wall) li.product img { display: block; width: 100% !important; height: auto !important; margin: 0 0 .7rem !important; box-shadow: var(--dpc-schatten); transition: transform .35s ease; }
:where(.dpc-wall) li.product:hover img { transform: translateY(-3px); }
:where(.dpc-wall) li.product .woocommerce-loop-product__title { font-family: inherit; font-size: 1.05rem !important; text-align: center; padding: 0 !important; margin: 0 !important; }
:where(.dpc-wall) li.product :is(.price, .button, .added_to_cart, .onsale) { display: none !important; }

:where(.dpc-chips) { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin: 0 0 2rem; }
:where(.dpc-chip) { font: inherit; font-size: .95rem; min-height: 44px; padding: .45em 1.15em; border-radius: 999px; border: 1px solid var(--dpc-linie); background: transparent; color: inherit; cursor: pointer; }
:where(.dpc-chip):hover { border-color: currentColor; }
:where(.dpc-chip.is-on) { background: var(--dpc-text); color: var(--dpc-grund); border-color: var(--dpc-text); }
:where(.dpc-mehr-wrap) { display: flex; flex-direction: column; align-items: center; gap: .6rem; margin-top: 1.5rem; }
:where(.dpc-mehr-wrap)[hidden] { display: none; }
:where(.dpc-mehr-info) { margin: 0; font-size: .95rem; opacity: .75; }
:where(.dpc-mehr) { font: inherit; min-height: 48px; padding: .7em 1.6em; border-radius: 999px; cursor: pointer; }
:where(.dpc-mehr)[aria-busy="true"] { opacity: .6; cursor: progress; }
:where(.dpc-wall) li.product.dpc-neu { animation: dpc-auf .6s ease both; }
@keyframes dpc-auf { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Shop-Auswahl ---------- */
:where(.dpc-shop) ul.products { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.5rem, 3vw, 2.25rem); margin: 0 !important; padding: 0 !important; list-style: none; }
:where(.dpc-shop) ul.products li.product { float: none !important; width: auto !important; margin: 0 !important; display: flex; flex-direction: column; align-items: center; gap: .5rem; text-align: center; }
:where(.dpc-shop) li.product a.woocommerce-LoopProduct-link { display: grid; grid-template-rows: 300px auto; justify-items: center; align-items: end; width: 100%; color: inherit; text-decoration: none; }
:where(.dpc-shop) li.product a.woocommerce-LoopProduct-link img { width: auto !important; max-width: 100%; height: auto !important; max-height: 300px; margin: 0 !important; box-shadow: var(--dpc-schatten); }
:where(.dpc-shop) li.product .woocommerce-loop-product__title { text-align: center; font-family: inherit; margin-top: .6rem !important; }
@media (max-width: 781px) { :where(.dpc-shop) ul.products { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { :where(.dpc-shop) ul.products { grid-template-columns: minmax(0, 1fr); } }

/* Rundbilder im Shop */
li.product.dpc-rund img, .dpc-rund .woocommerce-product-gallery__image img { border-radius: 50%; }

/* ---------- Lightbox ---------- */
.dpc-lightbox { position: fixed; inset: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(12, 10, 9, .94); color: #F4EFE6; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden; }
.dpc-lightbox::backdrop { background: rgba(12, 10, 9, .94); }
.dpc-lightbox[open] { display: flex; align-items: center; justify-content: center; }
.dpc-lb-buehne { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%; padding: 56px 72px 72px; box-sizing: border-box; touch-action: pan-y; }
.dpc-lb-bild { max-width: 100%; max-height: calc(100% - 3em); width: auto; height: auto; object-fit: contain; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); user-select: none; -webkit-user-drag: none; }
.dpc-lb-titel { margin: 1em 0 0; font-size: 1.05rem; text-align: center; min-height: 1.4em; }
.dpc-lb-zaehler { position: absolute; top: 18px; left: 22px; font-size: .9rem; opacity: .75; }
.dpc-lightbox button { position: absolute; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .3); background: rgba(0, 0, 0, .35); color: #fff; font-size: 26px; line-height: 1; cursor: pointer; }
.dpc-lightbox button:hover { background: rgba(255, 255, 255, .15); }
.dpc-lightbox button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.dpc-lb-zu { top: 12px; right: 14px; }
.dpc-lb-zurueck { left: 14px; top: 50%; transform: translateY(-50%); }
.dpc-lb-vor { right: 14px; top: 50%; transform: translateY(-50%); }
.dpc-lightbox[data-einzeln] .dpc-lb-zurueck, .dpc-lightbox[data-einzeln] .dpc-lb-vor, .dpc-lightbox[data-einzeln] .dpc-lb-zaehler { display: none; }
@media (max-width: 600px) {
	.dpc-lb-buehne { padding: 60px 10px 90px; }
	.dpc-lb-zurueck, .dpc-lb-vor { top: auto; bottom: 18px; transform: none; }
	.dpc-lb-zurueck { left: calc(50% - 64px); }
	.dpc-lb-vor { right: calc(50% - 64px); }
}
html.dpc-lb-offen { overflow: hidden; }

/* ---------- Verkauf auf Anfrage ---------- */
.dpc-anfrage { margin: 1.25rem 0 1.5rem; }
.dpc-anfrage-knopf { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: .75em 1.6em; border-radius: 999px; text-decoration: none !important; font-weight: 600; }
:where(.dpc-anfrage-knopf) { background: var(--wp--preset--color--contrast, #24212B); color: var(--wp--preset--color--base, #FAF7F2); }
.dpc-anfrage-hinweis { margin: .7rem 0 0; font-size: .92em; opacity: .75; max-width: 34em; }
