:root {
  --panel: #f1f1f1;
  --text: #fff;
  --text-dark: #050505;
  --muted: rgba(255, 255, 255, 0.68);
  --border: rgba(255, 255, 255, 0.08);
  --gap: 10px;
  --radius: 28px;
  --cell: 62px;
  --container: 1500px;
  --filter-bg: rgba(255, 255, 255, 0.05);
  --filter-active: #fff;
  --filter-active-text: #000;
  --transition: 1650ms cubic-bezier(.16, 1, .3, 1);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
  background: #0a0a0a;
  position: relative;
  overflow-x: hidden;
  padding: 40px 22px 80px;
}

body.has-project-overlay {
  overflow: hidden;
}

@media (pointer: fine) {
  *,
  *::before,
  *::after {
    cursor: none !important;
  }
}

/* BACKGROUND */

.bg-slideshow {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background-image: url("optimized/background-poster.jpg");
  background-size: cover;
  background-position: center;
  filter: blur(12px) saturate(1.18) brightness(1.08) contrast(0.94);
  transform: scale(1.12);
}

.bg-slideshow::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.10), rgba(0, 0, 0, 0.06)),
    rgba(26, 42, 96, 0.08);
  pointer-events: none;
}

.invert-cursor {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 10000;
  width: 26px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff;
  mix-blend-mode: difference;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(-50px, -50px, 0);
  transition:
    width 180ms ease,
    opacity 180ms ease;
  will-change: transform, opacity;
}

.invert-cursor.is-visible {
  opacity: 1;
}

.invert-cursor.is-active {
  width: 36px;
}

body.is-over-video-embed .invert-cursor {
  opacity: 0;
}

@media (pointer: coarse) {
  .invert-cursor {
    display: none;
  }
}

/* MAIN LAYOUT */

.portfolio {
  position: relative;
  z-index: 2;
  width: min(100%, var(--container));
  margin: 0 auto;
}

.topbar {
  position: relative;
  display: grid;
  gap: 24px;
  margin-bottom: 34px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  font-size: clamp(1.1rem, 1rem + 1vw, 1.8rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand-mark {
  width: clamp(48px, 4vw, 70px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: transparent;
  border: 1px solid var(--border);
  font-size: clamp(1.5rem, 2vw, 2.4rem);
  line-height: 1;
}

.headline-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 24px;
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 1.4rem + 4vw, 5rem);
  line-height: 0.92;
  letter-spacing: 0.004em;
  text-transform: uppercase;
  font-weight: 800;
  max-width: 11ch;
}

.headline-arrow {
  appearance: none;
  border: 0;
  padding: 0;
  position: absolute;
  right: 0;
  bottom: 0;
  width: clamp(48px, 4.2vw, 64px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #111;
  color: #fff;
  text-decoration: none;
  font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem);
  line-height: 1;
  font-weight: 700;
  transition:
    transform 220ms ease,
    background 220ms ease;
}

.headline-arrow::after {
  content: "Kontaktiere mich";
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translate(8px, -50%);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.82);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.headline-arrow[data-copied="true"]::after {
  content: "E-Mail kopiert";
}

.headline-arrow:hover,
.headline-arrow:focus-visible {
  background: #000;
  transform: translate(2px, -2px);
}

.headline-arrow:hover::after,
.headline-arrow:focus-visible::after {
  opacity: 1;
  transform: translate(0, -50%);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding-right: clamp(68px, 7vw, 96px);
}

.filter-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition:
    transform 180ms ease,
    background 180ms ease,
    color 180ms ease,
    opacity 180ms ease,
    border-color 180ms ease;
}

.filter-btn:hover {
  transform: translateY(-1px);
}

.filter-btn.is-active {
  background: var(--filter-active);
  color: var(--filter-active-text);
}

.grid-wrap {
  position: relative;
  overflow: visible;
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-auto-rows: var(--cell);
  gap: var(--gap);
  align-items: stretch;
}

.bento-item {
  position: relative;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  min-width: 0;
  outline: none;
  font: inherit;
  text-align: left;
  transform: translateZ(0);
  backface-visibility: hidden;
  will-change: transform;
}

.bento-item[hidden] {
  display: none;
}

/* CARD */

.bento-card {
  position: relative;
  height: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  clip-path: inset(0 round var(--radius));
  background: var(--panel);
  color: var(--text-dark);
  box-shadow: var(--shadow);
  isolation: isolate;
  contain: paint;
  transform: translateZ(0);
  backface-visibility: hidden;
  display: grid;
  grid-template-rows: 1fr auto;
  border: 0.5px solid rgba(255, 255, 255, 0.08);
  transition:
    border-radius var(--transition),
    border-color var(--transition),
    opacity var(--transition);
}

.bento-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
}

/* PASSIVER LIQUID-GLASS STATE */
.bento-item:not(.is-active) .bento-card {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.004) 42%, rgba(255, 255, 255, 0.045)),
    rgba(255, 255, 255, 0.004);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 0.5px solid rgba(255, 255, 255, 0.76);
  box-shadow:
    0 26px 74px rgba(0, 0, 0, 0.26),
    0 0 0 0.5px rgba(255, 255, 255, 0.24),
    0 0 34px rgba(255, 255, 255, 0.22),
    inset 0 0.25px 0 rgba(255, 255, 255, 0.56),
    inset 0 -1px 0 rgba(255, 255, 255, 0.18);
}

.bento-item:not(.is-active) .bento-card::after {
  opacity: 1;
  background:
    linear-gradient(112deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.14) 5%, transparent 13%),
    linear-gradient(302deg, transparent 80%, rgba(255, 255, 255, 0.18) 91%, rgba(255, 255, 255, 0.62) 100%);
  mix-blend-mode: normal;
}

/* HOVER / ACTIVE wieder normaler */
.bento-item:hover .bento-card,
.bento-item.is-active .bento-card {
  background: rgba(241, 241, 241, 0.96);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  border-color: rgba(255, 255, 255, 0.10);
}

.bento-media {
  position: relative;
  overflow: hidden;
  min-height: 0;
  background: rgba(255, 255, 255, 0.04);
}

.bento-media img,
.bento-media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition:
    transform var(--transition),
    opacity var(--transition);
}

/* FOTO/VIDEO SELBST WIE LIQUID GLASS IM PASSIVEN ZUSTAND */
.bento-item.has-media:not(.is-active) .bento-media img,
.bento-item.has-media:not(.is-active) .bento-media video {
  filter: grayscale(1) saturate(0) brightness(1.12) contrast(1.65);
  opacity: 0.135;
  mix-blend-mode: normal;
}

/* HOVER / ACTIVE wieder klar */
.bento-item.has-media:hover .bento-media img,
.bento-item.has-media:hover .bento-media video,
.bento-item.has-media.is-active .bento-media img,
.bento-item.has-media.is-active .bento-media video {
  filter: grayscale(0) saturate(1) brightness(1) contrast(1);
  opacity: 1;
  mix-blend-mode: normal;
}

/* leichter zoom */
.bento-item:not(.is-active) .bento-media img,
.bento-item:not(.is-active) .bento-media video {
  transform: scale(1.03);
}

.bento-item.has-media:hover .bento-media img,
.bento-item.has-media:hover .bento-media video {
  transform: scale(1.12);
}

.bento-item.is-active .bento-media img,
.bento-item.is-active .bento-media video {
  transform: scale(1.03);
}

.bento-logo-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  font-size: clamp(2rem, 1rem + 2.3vw, 4.6rem);
  font-weight: 800;
  letter-spacing: 0.012em;
  text-align: center;
  color: #111;
  z-index: 2;
  opacity: 1;
  transition: opacity var(--transition), transform var(--transition);
}

.bento-item.has-media.is-active .bento-logo-fallback {
  opacity: 0;
  transform: scale(0.96);
}

/* GLASS OVERLAY */
.bento-gradient {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 1;
  transition:
    opacity var(--transition);

  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.002) 40%, rgba(255, 255, 255, 0.035)),
    rgba(255, 255, 255, 0.002);

  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.bento-item.has-media .bento-gradient {
  opacity: 1;
}

.bento-item.has-media:hover .bento-gradient,
.bento-item.has-media.is-active .bento-gradient {
  opacity: 0;
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
}

/* META */

.bento-meta {
  position: absolute;
  inset: auto 16px 16px 16px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: end;
  z-index: 3;
  pointer-events: none;
  transition:
    inset var(--transition),
    transform var(--transition),
    opacity var(--transition);
}

.bento-item:not(.is-active) .bento-meta,
.bento-item:not(.is-active) .bento-logo-fallback {
  opacity: 0.72;
}

.bento-item:not(.is-active) .bento-logo-fallback {
  color: rgba(255, 255, 255, 0.96);
  text-shadow:
    0 1px 12px rgba(0, 0, 0, 0.24),
    0 0 28px rgba(255, 255, 255, 0.22);
}

.bento-item:hover .bento-logo-fallback,
.bento-item.is-active .bento-logo-fallback {
  opacity: 0;
  transform: scale(0.96);
}

.bento-kicker,
.bento-index {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #000;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* CONTENT */

.bento-content {
  position: relative;
  z-index: 4;
  display: grid;
  gap: 16px;
  padding: 0 22px;
  min-height: 0;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(14px);
  transition:
    max-height var(--transition),
    opacity 560ms ease,
    transform var(--transition),
    padding var(--transition);
}

.bento-item.is-active .bento-content {
  max-height: 420px;
  opacity: 1;
  transform: translateY(0);
  padding: 22px;
}

.bento-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.bento-title {
  margin: 0;
  font-size: clamp(1.2rem, 1rem + 1.1vw, 2rem);
  line-height: 0.95;
  letter-spacing: 0.006em;
  font-weight: 800;
  text-transform: uppercase;
  overflow-wrap: normal;
  word-break: normal;
}

.bento-title.has-manual-breaks {
  white-space: pre-line;
}

.bento-arrow {
  appearance: none;
  border: 0;
  flex: 0 0 auto;
  width: 44px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #111;
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  transition:
    transform 220ms ease,
    background 220ms ease;
}

.bento-arrow:hover {
  background: #000;
  transform: translate(2px, -2px);
}

.bento-description {
  margin: 0;
  color: rgba(0, 0, 0, 0.75);
  font-size: 0.98rem;
  line-height: 1.5;
  max-width: 58ch;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.bento-tags {
  display: flex;
  max-width: 100%;
}

.bento-tag {
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 7px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.76);
  background: rgba(0, 0, 0, 0.03);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bento-item.is-active .bento-card {
  border-radius: calc(var(--radius) + 4px);
  clip-path: inset(0 round calc(var(--radius) + 4px));
}

.bento-item.is-active .bento-meta {
  inset: 16px 16px auto 16px;
  align-items: start;
}

.bento-item:focus-visible .bento-card {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8), var(--shadow);
}

.empty-state {
  display: none;
  padding: 24px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  margin-top: 18px;
}

.empty-state.is-visible {
  display: block;
}

/* PROJECT OVERLAY */

.project-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 360ms ease;
}

.project-overlay.is-open {
  pointer-events: auto;
  opacity: 1;
}

.project-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.project-panel {
  position: relative;
  width: min(1120px, 100%);
  max-height: min(86vh, 980px);
  overflow: auto;
  border-radius: 30px;
  background: rgba(242, 242, 238, 0.96);
  color: #090909;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.42);
  transform: translateY(22px) scale(0.985);
  transition: transform 480ms cubic-bezier(.22, .8, .18, 1);
}

.project-overlay.is-open .project-panel {
  transform: translateY(0) scale(1);
}

.project-close {
  position: sticky;
  top: 18px;
  left: calc(100% - 64px);
  z-index: 2;
  width: 46px;
  aspect-ratio: 1;
  margin: 18px 18px 0 auto;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #111;
  color: #fff;
  font: inherit;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

.project-panel-inner {
  display: grid;
  gap: 28px;
  padding: 4px clamp(20px, 4vw, 54px) clamp(24px, 5vw, 60px);
}

.project-header {
  display: grid;
  gap: 14px;
}

.project-kicker {
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.07);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.project-title {
  margin: 0;
  max-width: 16ch;
  font-size: clamp(2.4rem, 6.2vw, 6.1rem);
  line-height: 1.03;
  letter-spacing: 0.015em;
  text-transform: uppercase;
  overflow-wrap: normal;
  word-break: normal;
}

.project-title.has-manual-breaks {
  white-space: pre;
}

.project-intro {
  margin: 0;
  max-width: 70ch;
  color: rgba(0, 0, 0, 0.72);
  font-size: clamp(1rem, 0.9rem + 0.45vw, 1.26rem);
  line-height: 1.55;
}

.project-media,
.project-embed {
  overflow: hidden;
  border-radius: 24px;
  background: #deded8;
}

.project-media img,
.project-media video {
  width: 100%;
  min-height: 280px;
  max-height: 620px;
  object-fit: cover;
  display: block;
}

.project-media--compact-contain {
  width: min(100%, 850px);
  margin-inline: auto;
  background: transparent;
}

.project-media--compact-contain img,
.project-media--compact-contain video {
  aspect-ratio: 1 / 1;
  min-height: 0;
  max-height: min(66vh, 650px);
  object-fit: contain;
  background: transparent;
}

.project-embeds {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

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

.project-embed {
  aspect-ratio: 16 / 9;
  position: relative;
}

.project-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  pointer-events: auto;
  cursor: auto !important;
}

.project-embed,
.project-embed * {
  cursor: auto !important;
}

.project-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.project-gallery img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 18px;
  display: block;
}

.article-spread {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  align-items: start;
  padding: 0;
  background: transparent;
  box-shadow: none;
  overflow: auto;
}

.article-page {
  margin: 0;
  min-width: 0;
  background: transparent;
}

.article-page:first-child {
  border-radius: 14px 0 0 14px;
}

.article-page:last-child {
  border-radius: 0 14px 14px 0;
}

.article-page img {
  width: 100%;
  height: auto;
  display: block;
}

.project-text-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.project-text-card {
  padding: 20px;
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.045);
}

.project-text-card--brand {
  grid-column: 1 / -1;
}

.project-text-card h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  text-transform: uppercase;
}

.project-text-card p {
  margin: 0;
  color: rgba(0, 0, 0, 0.7);
  line-height: 1.55;
}

.project-text-list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  list-style: none;
  color: rgba(0, 0, 0, 0.72);
  line-height: 1.45;
}

.project-text-list li {
  padding-left: 14px;
  border-left: 3px solid rgba(0, 0, 0, 0.18);
}

.project-text-list strong {
  color: #000;
}

.project-brand-overview {
  display: grid;
  gap: 14px;
}

.project-brand-note {
  margin: 0;
  max-width: 78ch;
  color: rgba(0, 0, 0, 0.7);
  line-height: 1.5;
}

.project-brand-palette {
  display: grid;
  grid-template-columns: repeat(3, minmax(88px, 120px));
  gap: 12px;
}

.project-brand-swatch {
  display: grid;
  gap: 6px;
}

.project-brand-color {
  display: grid;
  place-items: end start;
  min-height: 96px;
  padding: 10px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1;
}

.project-brand-swatch small,
.project-brand-asset figcaption {
  color: rgba(0, 0, 0, 0.6);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.project-brand-assets {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 12px;
  align-items: stretch;
}

.project-brand-asset {
  margin: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  min-height: 132px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
}

.project-brand-asset img {
  max-width: 100%;
  max-height: 105px;
  object-fit: contain;
  display: block;
}

.project-placeholder {
  border: 1px dashed rgba(0, 0, 0, 0.2);
  border-radius: 22px;
  padding: 20px;
  color: rgba(0, 0, 0, 0.62);
  background: rgba(255, 255, 255, 0.32);
}

/* RESPONSIVE */

@media (max-width: 1180px) {
  :root {
    --cell: 54px;
    --radius: 24px;
  }

  body {
    padding-inline: 18px;
  }

  h1 {
    font-size: clamp(2.2rem, 1.2rem + 5vw, 4.6rem);
  }

  .filter-btn {
    padding: 10px 18px;
  }
}

@media (max-width: 680px) {
  :root {
    --gap: 10px;
    --cell: 46px;
    --radius: 20px;
    --bg-fade-duration: 6000ms;
    --bg-image-duration: 9000ms;
    --transition: 1450ms cubic-bezier(.16, 1, .3, 1);
  }

  body {
    padding: 24px 12px 64px;
  }

  .topbar {
    gap: 18px;
    margin-bottom: 24px;
  }

  .headline-row {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: clamp(2.4rem, 18vw, 4rem);
    max-width: 8ch;
  }

  .headline-arrow {
    display: none;
  }

  .filters {
    gap: 8px;
    padding-right: 0;
  }

  .filter-btn {
    padding: 9px 12px;
    font-size: 0.86rem;
  }

  .bento-item.is-active .bento-content {
    max-height: 520px;
  }

  .project-overlay {
    padding: 10px;
  }

  .project-panel {
    max-height: 92vh;
    border-radius: 22px;
  }

  .project-gallery,
  .project-embeds,
  .article-spread,
  .project-text-grid,
  .project-brand-palette,
  .project-brand-assets {
    grid-template-columns: 1fr;
  }

  .article-page:first-child,
  .article-page:last-child {
    border-radius: 14px;
  }

  .project-media img,
  .project-media video {
    min-height: 220px;
  }
}
