/* Projekte, Dialoge, Vorher/Nachher – nutzt die Design-Tokens (hell/dunkel automatisch) */

/* ---- Filter ---- */
.mg-chips { display: flex; flex-wrap: wrap; gap: .6rem; margin: 0 0 1.5rem; }
.mg-chip { min-height: 44px; padding: .5rem 1.15rem; border-radius: var(--mg-radius-pill); border: 1.5px solid var(--mg-line); background: transparent; color: var(--mg-text); font: 600 1rem/1 var(--mg-font); cursor: pointer; transition: background-color .2s, border-color .2s, color .2s; }
.mg-chip:hover { border-color: var(--mg-primary); }
.mg-chip.is-on { background: var(--mg-primary); border-color: var(--mg-primary); color: var(--mg-on-primary); }
.mg-chip:focus-visible { outline: 2px solid var(--mg-focus); outline-offset: 3px; }

/* ---- Karten ---- */
.mg-projects__list { list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(1rem, 2.5vw, 1.75rem); grid-template-columns: repeat(auto-fill, minmax(min(100%, 17.5rem), 1fr)); }
.mg-pcard[hidden] { display: none !important; }
.mg-pcard { margin: 0; padding: 0; }
.mg-pcard__btn { display: flex; flex-direction: column; height: 100%; text-decoration: none; color: inherit !important; background: var(--mg-bg); border: 1px solid var(--mg-line); border-radius: var(--mg-radius-lg); overflow: hidden; transition: transform .25s, box-shadow .25s; }
.mg-section--alt .mg-pcard__btn, .mg-section--sand .mg-pcard__btn { background: var(--mg-bg); }
.mg-pcard__btn:hover { transform: translateY(-3px); box-shadow: var(--mg-shadow); }
.mg-pcard__btn:focus-visible { outline: 3px solid var(--mg-focus); outline-offset: 3px; }
.mg-pcard__img { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--mg-surface-alt);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M0 0H100V90C84 99 66 86 48 94S14 97 0 91Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M0 0H100V90C84 99 66 86 48 94S14 97 0 91Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat; }
.mg-pcard__img img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.mg-pcard__btn:hover .mg-pcard__img img { transform: scale(1.05); }
.mg-pcard__meta { display: flex; flex-direction: column; gap: .2rem; padding: .9rem 1.4rem 1.3rem; }
.mg-pcard__cat { font-size: .82rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--mg-sea); }
.mg-pcard__title { font: 600 1.2rem/1.3 var(--mg-font); }
.mg-pcard__count { font-size: .95rem; color: var(--mg-text-muted); }
.mg-projects__more { margin: 2rem 0 0; text-align: center; }

/* ---- Dialog ---- */
html.mg-lock { overflow: hidden; }
.mg-dlg { box-sizing: border-box; width: min(62rem, calc(100% - 1.5rem)); max-height: min(94dvh, 60rem); margin: auto; padding: 0; border: 1px solid var(--mg-line); border-radius: var(--mg-radius-lg); background: var(--mg-bg); color: var(--mg-text); box-shadow: 0 24px 80px rgb(0 0 0 / .35); overflow: auto; overscroll-behavior: contain; }
.mg-dlg[open] { animation: mg-dlg-in .32s cubic-bezier(.2, .7, .2, 1); }
.mg-dlg::backdrop { background: rgb(8 16 12 / .62); backdrop-filter: blur(3px); }
@keyframes mg-dlg-in { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }
.mg-dlg__bar { position: sticky; top: 0; z-index: 3; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.25rem 1.5rem 1rem; background: var(--mg-bg); border-bottom: 1px solid var(--mg-line); }
.mg-dlg__bar h2 { margin: 0; font-size: clamp(1.35rem, 3.4vw, 1.9rem); line-height: 1.2; }
.mg-dlg__bar .mg-eyebrow { margin: 0 0 .25rem !important; }
.mg-dlg__close { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--mg-line); background: var(--mg-bg); color: var(--mg-text); cursor: pointer; transition: background-color .2s, border-color .2s; }
.mg-dlg__close:hover { background: var(--mg-surface-alt); border-color: var(--mg-primary); }
.mg-dlg__close:focus-visible, .mg-pstage__nav:focus-visible, .mg-ptab:focus-visible, .mg-psteps button:focus-visible, .mg-sdlg__pbtn:focus-visible { outline: 3px solid var(--mg-focus); outline-offset: 2px; }
.mg-dlg__body { padding: 1.25rem 1.5rem 1.75rem; }

/* Projekt: Bühne */
.mg-ptabs { display: inline-flex; gap: .25rem; padding: .25rem; margin-bottom: 1rem; border-radius: var(--mg-radius-pill); background: var(--mg-surface-alt); }
.mg-ptab { min-height: 40px; padding: .4rem 1.1rem; border: 0; border-radius: var(--mg-radius-pill); background: transparent; color: var(--mg-text); font: 600 .98rem/1 var(--mg-font); cursor: pointer; }
.mg-ptab.is-on { background: var(--mg-primary); color: var(--mg-on-primary); }
.mg-pstage { position: relative; }
.mg-pstage figure { margin: 0; }
.mg-pstage__frame { display: grid; place-items: center; border-radius: var(--mg-radius); background: var(--mg-surface-alt); overflow: hidden; }
.mg-pstage__frame img { display: block; width: 100%; height: auto; max-height: min(62dvh, 40rem); object-fit: contain; animation: mg-photo-in .35s ease; }
@keyframes mg-photo-in { from { opacity: 0; } to { opacity: 1; } }
.mg-pstage figcaption { display: flex; align-items: baseline; gap: .75rem; padding: .8rem .25rem 0; font-size: 1.05rem; }
.mg-pstage__n { flex: none; font: 700 1.15rem/1 var(--mg-font); color: var(--mg-primary); }
.mg-pstage__nav { position: absolute; top: calc(50% - 1.6rem); display: grid; place-items: center; width: 48px; height: 48px; border: 0; border-radius: 50%; background: rgb(251 248 242 / .92); color: #14181A; box-shadow: 0 2px 10px rgb(0 0 0 / .25); cursor: pointer; transition: transform .2s; }
.mg-pstage__nav:hover { transform: scale(1.08); }
.mg-pstage__nav--prev { left: .75rem; }
.mg-pstage__nav--next { right: .75rem; }
.mg-pstage__hint { margin: .75rem .25rem 0; color: var(--mg-text-muted); font-size: .95rem; }

/* Projekt: Zeitleiste mit Miniaturen */
.mg-psteps { list-style: none; display: flex; gap: .75rem; margin: 1.1rem 0 0; padding: .35rem .15rem .6rem; overflow-x: auto; scrollbar-width: thin; }
.mg-psteps[hidden] { display: none; }
.mg-psteps li { position: relative; flex: none; margin: 0; padding: 0; }
.mg-psteps li + li::before { content: ""; position: absolute; top: 50%; right: 100%; width: .75rem; height: 3px; margin-top: -1.5px; background: var(--mg-line); }
.mg-psteps li.is-done::before, .mg-psteps li.is-on::before { background: var(--mg-primary); }
.mg-psteps button { display: block; width: 76px; height: 58px; padding: 0; border: 3px solid transparent; border-radius: 14px; overflow: hidden; background: var(--mg-surface-alt); cursor: pointer; opacity: .7; transition: opacity .2s, border-color .2s, transform .2s; }
.mg-psteps li.is-done button { border-color: color-mix(in srgb, var(--mg-primary) 45%, transparent); opacity: .9; }
.mg-psteps li.is-on button { border-color: var(--mg-primary); opacity: 1; transform: translateY(-2px); }
.mg-psteps button:hover { opacity: 1; }
.mg-psteps img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mg-pmeta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 1.5rem; margin-top: .6rem; padding-top: 1.1rem; border-top: 1px solid var(--mg-line); }
.mg-pmeta__text { flex: 1 1 22rem; margin: 0; max-width: 40rem; color: var(--mg-text-muted); font-size: 1.08rem; }

/* Vorher/Nachher */
.mg-cmp { --p: 50%; position: relative; width: 100%; max-height: min(62dvh, 40rem); border-radius: var(--mg-radius); overflow: hidden; background: var(--mg-surface-alt); user-select: none; }
.mg-cmp img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mg-cmp__before { clip-path: inset(0 calc(100% - var(--p)) 0 0); }
.mg-cmp__tag { position: absolute; top: .8rem; padding: .3rem .8rem; border-radius: var(--mg-radius-pill); background: rgb(15 26 22 / .78); color: #F2EBDD; font-size: .88rem; font-weight: 600; pointer-events: none; }
.mg-cmp__tag--b { left: .8rem; }
.mg-cmp__tag--a { right: .8rem; }
.mg-cmp__handle { position: absolute; top: 0; bottom: 0; left: var(--p); width: 3px; margin-left: -1.5px; background: #fff; box-shadow: 0 0 8px rgb(0 0 0 / .4); color: var(--mg-primary); pointer-events: none; }
.mg-cmp__handle svg { position: absolute; top: 50%; left: 50%; margin: -22px 0 0 -22px; filter: drop-shadow(0 2px 6px rgb(0 0 0 / .35)); }
.mg-cmp__range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; touch-action: pan-y; }
.mg-cmp:has(.mg-cmp__range:focus-visible) { outline: 3px solid var(--mg-focus); outline-offset: 3px; }

/* Leistung: Dialog */
.mg-sdlg { display: grid; grid-template-columns: auto 1fr; gap: 1.25rem 1.5rem; align-items: start; }
.mg-sdlg__icon { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 24px; background: var(--mg-surface-alt); }
.mg-sdlg__text p { margin: 0 0 1rem; font-size: 1.1rem; line-height: 1.65; }
.mg-sdlg__text p:last-child { margin-bottom: 0; }
.mg-sdlg__lbl { margin: 1.75rem 0 .75rem !important; }
.mg-sdlg__proj { list-style: none; display: flex; flex-wrap: wrap; gap: .75rem; margin: 0; padding: 0; }
.mg-sdlg__proj li { margin: 0; padding: 0; }
.mg-sdlg__pbtn { display: flex; align-items: center; gap: .75rem; min-height: 64px; padding: .4rem 1.1rem .4rem .4rem; border: 1px solid var(--mg-line); border-radius: 18px; background: var(--mg-bg); color: var(--mg-text); font: 600 1rem/1.25 var(--mg-font); text-align: left; cursor: pointer; transition: border-color .2s, background-color .2s; }
.mg-sdlg__pbtn:hover { border-color: var(--mg-primary); background: var(--mg-surface-alt); }
.mg-sdlg__pbtn img { width: 64px; height: 48px; border-radius: 12px; object-fit: cover; }
.mg-sdlg__cta { margin: 1.75rem 0 0; }

/* Leistungs-Karten mit <details> (Divi-Textmodul) */
details.mg-more { margin-top: .9rem; }
details.mg-more > summary { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: .3rem 0; font-weight: 600; color: var(--mg-primary); cursor: pointer; list-style: none; }
details.mg-more > summary::-webkit-details-marker { display: none; }
details.mg-more > summary::after { content: "+"; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--mg-primary); color: var(--mg-on-primary); font-size: 1.1rem; line-height: 1; transition: transform .25s; }
details.mg-more[open] > summary::after { transform: rotate(45deg); }
details.mg-more > summary:focus-visible { outline: 2px solid var(--mg-focus); outline-offset: 3px; border-radius: 8px; }
.mg-feature--more { cursor: default; }
.mg-body .mg-feature .mg-more__body p { font-size: 1rem; }

@media (max-width: 640px) {
	.mg-dlg { width: 100%; max-width: none; max-height: 96dvh; margin: auto 0 0; border-radius: var(--mg-radius-lg) var(--mg-radius-lg) 0 0; border-bottom: 0; }
	.mg-dlg__bar { padding: 1rem 1rem .85rem; }
	.mg-dlg__body { padding: 1rem 1rem 1.5rem; }
	.mg-sdlg { grid-template-columns: 1fr; }
	.mg-sdlg__icon { width: 64px; height: 64px; border-radius: 18px; }
	.mg-pstage__nav { width: 44px; height: 44px; }
	.mg-pmeta .mg-btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
	.mg-dlg[open], .mg-pstage__frame img { animation: none; }
	.mg-pcard__btn, .mg-pcard__img img, .mg-psteps button { transition: none; }
}

/* Divi/WordPress setzen Listenstile mit hoher Spezifität zurück */
html body .mg-projects ul.mg-projects__list, html body .mg-dlg ul.mg-sdlg__proj { list-style: none; margin: 0; padding: 0; }
html body .mg-dlg ol.mg-psteps { list-style: none; margin: 1.1rem 0 0; padding: .35rem .15rem .6rem; }
html body .mg-projects li, html body .mg-dlg li { list-style: none; }
.mg-body .et_pb_column.mg-feature--more { display: flex; flex-direction: column; }
.mg-feature--more .et_pb_text, .mg-feature--more .et_pb_text_inner { display: flex; flex-direction: column; flex: 1 1 auto; }
.mg-feature--more details.mg-more { margin-top: auto; padding-top: .6rem; }
