/* Projekte page v2: a picture-led gallery in three areas. Shared tokens, surfaces, hero, close and footer come from ../css/site.css. */

/* ---------- Hero: a wall of all works ---------- */
.pj-hero { --hero-fit: 12.6; --hero-fit-m: 6.2; --window-bg: var(--nacht); }
.wall { position: absolute; inset: 0; display: grid; grid-template-rows: 1fr 1fr; row-gap: 4cqh; padding: 7cqh 0; }
.wall__row { overflow: hidden; display: flex; align-items: center; }
.wall__track { display: flex; align-items: center; gap: 3cqh; width: max-content; height: 100%; padding-left: 3cqh; }
.wall__tile { flex: none; height: 100%; width: auto; aspect-ratio: 16 / 10; object-fit: cover; object-position: top center; box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--creme) 30%, var(--nacht)); }
.wall__tile--tall { aspect-ratio: 4 / 5; }
@keyframes wall-left { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes wall-right { from { transform: translateX(-50%); } to { transform: translateX(0); } }
.wall__row.is-looping .wall__track { animation: wall-left 80s linear infinite; }
.wall__row--b.is-looping .wall__track { animation-name: wall-right; animation-duration: 90s; }

/* ---------- Area bar: floats at the bottom edge while the areas are on screen (on the phone under the header, the dock owns the bottom) ---------- */
.catbar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 45;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--round);
  background: var(--nacht);
  color: var(--creme);
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--creme) 22%, var(--nacht)), 0 18px 40px -20px color-mix(in oklab, var(--nacht) 80%, transparent);
  transform: translate(-50%, 16px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-fast-out) var(--ease-exit), transform var(--dur-fast-out) var(--ease-exit), visibility 0s linear var(--dur-fast-out);
}
.catbar.is-shown { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition: opacity var(--dur-moderate) var(--ease-enter), transform var(--dur-moderate) var(--ease-enter), visibility 0s; }
html:not(.js) .catbar { display: none; }
.catbar__link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: var(--round); font-size: var(--t-small); font-weight: 500; transition: background-color var(--dur-fast-out) var(--ease-exit), color var(--dur-fast-out) var(--ease-exit); }
.catbar__link .tnum { font-size: var(--t-label); color: color-mix(in oklab, var(--creme) 70%, var(--nacht)); }
.catbar__link:hover { background: color-mix(in oklab, var(--creme) 12%, var(--nacht)); }
.catbar__link.is-active { background: var(--gelb); color: var(--nacht); transition-duration: var(--dur-fast); transition-timing-function: var(--ease-enter); }
.catbar__link.is-active .tnum { color: var(--nacht); }
.catbar__link:focus-visible { outline-color: var(--creme); }

/* ---------- 01 Produkte: each product its own stage; text with clear calls to action, three screens fanned like cards ---------- */
.product { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); align-items: center; padding-block: var(--space-6); border-top: 1px solid var(--line); scroll-margin-top: calc(var(--nav-h) + 72px); }
.product + .product { margin-top: var(--space-4); }
.product__text { grid-column: 1 / 6; display: grid; align-content: start; gap: var(--space-3); }
.product__peek { grid-column: 6 / 13; }
.product--flip .product__text { grid-column: 8 / 13; grid-row: 1; }
.product--flip .product__peek { grid-column: 1 / 8; grid-row: 1; }
.product__kind { display: flex; flex-wrap: wrap; gap: 8px; }
.product__name { font-size: clamp(4.5rem, 2rem + 8vw, 10rem); line-height: 0.86; font-weight: 250; letter-spacing: -0.055em; }
.product__pitch { max-width: 36ch; font-size: var(--t-l); line-height: 1.38; font-weight: 300; text-wrap: pretty; }
/* One shared first column (subgrid): the widest key word sets it, so numbers and words line up and never run into the text. */
.product__points { display: grid; grid-template-columns: max-content 1fr; column-gap: var(--space-3); row-gap: var(--space-1); }
.product__points li { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: baseline; padding-top: var(--space-1); border-top: 1px solid var(--line); }
.product__points b { font-size: clamp(1.75rem, 1.2rem + 1vw, 2.25rem); line-height: 1; font-weight: 750; letter-spacing: -0.03em; }
.product__points span { color: var(--muted); }
.product__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.button--solid { background: var(--fg); color: var(--bg); transition: transform var(--dur-fast-out) var(--ease-exit); }
.button--solid:hover { transform: translateY(-2px); transition: transform var(--dur-fast) var(--ease-enter); }
.product .button .icon { width: 18px; height: 18px; }
/* The fan: --fan runs from 0 (stacked) to 1 (open); each card has its own offset and turn. */
.product__peek { position: relative; aspect-ratio: 16 / 12; --fan: 1; }
.js .product__peek { --fan: 0; }
.peek__card { position: absolute; left: 11%; top: 9%; width: 78%; aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--card); background: var(--nacht); box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--fg) 40%, transparent), 0 30px 60px -30px color-mix(in oklab, var(--nacht) 90%, transparent); cursor: zoom-in; transition: box-shadow var(--dur-fast-out) var(--ease-exit); }
.peek__card img { width: 100%; height: 100%; object-fit: cover; object-position: top left; transition: transform var(--dur-slow-out) var(--ease-exit); }
.peek__card:nth-child(1) { z-index: 1; transform: translate(calc(var(--fan) * -14%), calc(var(--fan) * 12%)) rotate(calc(var(--fan) * -5deg)); }
.peek__card:nth-child(2) { z-index: 2; transform: translate(0, calc(var(--fan) * 1%)) rotate(calc(var(--fan) * 1deg)); }
.peek__card:nth-child(3) { z-index: 3; transform: translate(calc(var(--fan) * 14%), calc(var(--fan) * -9%)) rotate(calc(var(--fan) * 5deg)); }
.peek__card:hover, .peek__card:focus-visible { z-index: 4; box-shadow: 0 0 0 2px var(--fg), 0 30px 60px -30px color-mix(in oklab, var(--nacht) 90%, transparent); transition: box-shadow var(--dur-fast) var(--ease-enter); }
.peek__card:hover img { transform: scale(1.04); transition: transform var(--dur-slow) var(--ease-enter); }
.peek__card:focus-visible { outline: 2px solid var(--fg); outline-offset: 4px; }
@media (max-width: 1080px) {
  .product__text, .product--flip .product__text { grid-column: 1 / -1; grid-row: 1; }
  .product__peek, .product--flip .product__peek { grid-column: 1 / -1; grid-row: 2; margin-top: var(--space-5); }
}
@media (max-width: 640px) {
  .product { padding-block: var(--space-5); }
  .product__name { font-size: 4.75rem; }
  .product__points { column-gap: var(--space-2); }
  .product__points b { font-size: 1.5rem; }
  .product__actions .button { width: 100%; justify-content: center; }
  .product__peek { aspect-ratio: 16 / 13; }
}

/* ---------- Gallery: shared tile system ---------- */
.pj-cat { scroll-margin-top: 0; }
.pj-cat .section-head { margin-bottom: var(--space-7); }
.gallery { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: var(--space-7); }
.work { grid-column: span 6; display: grid; align-content: start; gap: var(--space-3); scroll-margin-top: calc(var(--nav-h) + 72px); }
.work__media { position: relative; display: block; overflow: hidden; border-radius: var(--card); background: var(--soft); box-shadow: 0 0 0 1px var(--line); cursor: zoom-in; isolation: isolate; }
.work__media > img { width: 100%; height: auto; transition: transform var(--dur-slow-out) var(--ease-exit); }
.work__media:not(.frame):hover > img { transform: scale(1.03); transition: transform var(--dur-slow) var(--ease-enter); }
.work__media:focus-visible { outline: 2px solid var(--fg); outline-offset: 4px; }
/* The open mark: a circle in the corner that grows a little under the pointer; the same circle the lightbox opens from. */
.work__open { position: absolute; right: 16px; top: 16px; z-index: 3; display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--round); background: var(--gelb); color: var(--nacht); transform: scale(0.84); transition: transform var(--dur-moderate-out) var(--ease-exit); }
.work__open .icon { width: 20px; height: 20px; }
.work__media:hover .work__open, .work__media:focus-visible .work__open { transform: scale(1.08); transition: transform var(--dur-moderate) var(--ease-enter); }
.work__count { position: absolute; left: 16px; bottom: 16px; z-index: 3; display: inline-flex; align-items: center; min-height: 30px; padding: 0 14px; border-radius: var(--round); background: var(--nacht); color: var(--creme); font-size: 0.8125rem; font-weight: 600; }
.work__meta { display: grid; gap: var(--space-2); }
.work__name { font-size: clamp(2.25rem, 3.6vw, 3.75rem); line-height: 0.95; font-weight: 300; letter-spacing: -0.035em; overflow-wrap: anywhere; }
.work__name em { color: var(--accent); }
.work__tags { display: flex; flex-wrap: wrap; gap: 8px; }
.work__text { max-width: 54ch; color: var(--muted); text-wrap: pretty; }
.work__text strong { color: var(--fg); font-weight: 600; }
.work__links { display: flex; flex-wrap: wrap; gap: 0 var(--space-4); }

/* Website frames: 3:2 windows, the long page runs through them; the phone stands in front at the lower right. */
.frame { aspect-ratio: 3 / 2; }
.frame__page { width: 100%; height: auto; will-change: transform; }
/* Vorschaubild statt ganzer Seite (16:10): fuellt den 3:2-Rahmen von oben, nichts laeuft durch. */
.frame__page--bild { height: 100%; object-fit: cover; object-position: top center; }
.work__phone { position: absolute; right: 5%; bottom: -6%; z-index: 2; width: 21%; overflow: hidden; border-radius: 14px 14px 0 0; background: var(--nacht); box-shadow: 0 0 0 1.5px var(--creme), 0 24px 48px -20px color-mix(in oklab, var(--nacht) 80%, transparent); }
.work__phone img { width: 100%; height: auto; }

/* The free place in the websites grid keeps the rows even: a dashed frame of the same size as the others. */
.work--empty { grid-column: span 6; align-content: center; justify-items: start; gap: var(--space-4); aspect-ratio: 3 / 2; padding: var(--space-5); border: 1.5px dashed var(--line); border-radius: var(--card); }
.work__ring { width: clamp(96px, 11vw, 160px); aspect-ratio: 1; border: 1.5px dashed var(--fg); border-radius: var(--round); }
/* Steht der freie Platz allein in seiner Reihe (ungerade Zahl der Arbeiten, seit 01.11. zehn), nimmt er die ganze Breite. */
@media (min-width: 641px) { .gallery > .work--empty:last-child:nth-child(odd) { grid-column: 1 / -1; aspect-ratio: auto; min-height: 240px; } }
.work__empty { font-size: var(--t-title); line-height: 1.08; font-weight: 300; letter-spacing: -0.02em; max-width: 24ch; text-wrap: balance; }

/* Software: two products with screens, three licence products as type tiles (no pictures exist for them). */
.work--product .work__media { aspect-ratio: 16 / 10; }
.work--product .work__media > img { height: 100%; object-fit: cover; object-position: top left; }
.type-tile {
  grid-column: span 4;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: var(--space-2);
  min-height: 420px;
  padding: var(--space-4);
  border-radius: var(--card);
  background: var(--nacht);
  color: var(--creme);
  --fg: var(--creme); --muted: color-mix(in oklab, var(--creme) 76%, var(--nacht));
  container-type: inline-size;
  scroll-margin-top: calc(var(--nav-h) + 72px);
}
.type-tile__state { justify-self: start; }
.type-tile__name { align-self: end; font-size: calc(100cqw / 5.1); line-height: 0.9; font-weight: 800; letter-spacing: -0.045em; white-space: nowrap; }
.type-tile__text { color: var(--muted); max-width: 40ch; text-wrap: pretty; }
.type-tile__tech { padding-top: var(--space-2); border-top: 1px solid color-mix(in oklab, var(--creme) 24%, var(--nacht)); font-size: var(--t-small); font-weight: 500; }

/* Grafikdesign: strict rows; wide 8 + tall 4 have the same height, halves pair, the panorama closes. */
.piece { display: grid; gap: var(--space-2); align-content: start; scroll-margin-top: calc(var(--nav-h) + 72px); }
.piece--wide { grid-column: span 8; }
.piece--tall { grid-column: span 4; }
.piece--half { grid-column: span 6; }
.piece--panorama { grid-column: 1 / -1; }
.piece--wide .work__media { aspect-ratio: 16 / 10; }
.piece--tall .work__media { aspect-ratio: 4 / 5; }
.piece--wide .work__media > img, .piece--tall .work__media > img { height: 100%; object-fit: cover; }
.piece--tall .work__media { align-self: stretch; }
.work__media--tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.work__media--tiles > img { aspect-ratio: 3 / 4; height: auto; object-fit: cover; object-position: 50% 50%; }
.piece__cap { display: grid; gap: 4px; }
.piece__name { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: var(--t-l); font-weight: 400; letter-spacing: -0.01em; }
.piece__meta { font-size: var(--t-small); color: var(--muted); }

.orbit-build { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); align-items: center; margin-bottom: var(--space-8); scroll-margin-top: calc(var(--nav-h) + 72px); }
.orbit-build__stage { grid-column: 1 / 8; position: relative; aspect-ratio: 1; max-height: 78svh; justify-self: center; width: 100%; max-width: 680px; border-radius: var(--card); background: var(--creme); }
.orbit-build__mark { width: 100%; height: 100%; overflow: visible; }
.orbit-build__guides { stroke: color-mix(in oklab, var(--nacht) 26%, var(--creme)); stroke-width: 0.35; stroke-dasharray: 1.2 1.6; }
.orbit-build__ghost { stroke-dasharray: none; }
.orbit-build__ring { stroke: var(--blau); stroke-dasharray: 1 1; stroke-dashoffset: 0; }
.orbit-build__core { fill: var(--koralle); transform-box: fill-box; transform-origin: center; }
.orbit-build__big { fill: var(--nacht); transform-box: fill-box; transform-origin: center; }
.orbit-build__small { fill: var(--koralle); transform-box: fill-box; transform-origin: center; }
.orbit-build__marks { position: absolute; inset: 0; pointer-events: none; }
.om { position: absolute; left: var(--x); top: var(--y); display: grid; place-items: center; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: var(--round); background: var(--nacht); color: var(--creme); font-size: 0.6875rem; font-weight: 600; box-shadow: 0 0 0 2px var(--creme); }
.orbit-build__text { grid-column: 9 / 13; display: grid; row-gap: var(--space-2); }
.orbit-build__name { font-size: clamp(2rem, 2.8vw, 2.75rem); font-weight: 300; letter-spacing: -0.03em; line-height: 1.05; }
.orbit-build__desc { color: var(--muted); max-width: 38ch; text-wrap: pretty; }
.orbit-build__legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: var(--space-2); }
.orbit-build__legend > span { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 14px 0 6px; border: 1px solid var(--line); border-radius: var(--round); font-size: var(--t-small); }
.orbit-build__legend b { display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: var(--round); background: var(--nacht); color: var(--creme); font-size: 0.6875rem; font-weight: 600; }

.pj-close { --close-fit: 11.4; --close-fit-m: 7.6; }

/* ---------- Großansicht ---------- */
.lightbox { position: fixed; inset: 0; z-index: 90; color: var(--creme); --fg: var(--creme); --muted: color-mix(in oklab, var(--creme) 76%, var(--nacht)); --line: color-mix(in oklab, var(--creme) 24%, var(--nacht)); }
.lightbox[hidden] { display: none; }
.lightbox__backdrop { position: absolute; inset: 0; background: var(--nacht); }
.lightbox__figure { position: absolute; inset: 0; display: grid; grid-template-rows: 1fr auto; padding: 72px 96px 24px; pointer-events: none; }
.lightbox__stage { position: relative; min-height: 0; }
.lightbox__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: auto; touch-action: pan-y; user-select: none; -webkit-user-drag: none; }
.lightbox__bar { display: flex; justify-content: space-between; gap: var(--space-3); padding-top: var(--space-2); font-size: var(--t-small); pointer-events: auto; }
.lightbox__caption { max-width: 70ch; }
.lightbox__count { color: var(--muted); }
.lightbox__btn { position: absolute; display: grid; place-items: center; width: 52px; height: 52px; border-radius: var(--round); border: 1px solid var(--line); color: var(--creme); background: var(--nacht); transition: border-color var(--dur-fast-out) var(--ease-exit); }
.lightbox__btn:hover { border-color: var(--creme); transition: border-color var(--dur-fast) var(--ease-enter); }
.lightbox__btn:focus-visible { outline: 2px solid var(--creme); outline-offset: 3px; }
.lightbox__btn--close { top: 14px; right: 18px; }
.lightbox__btn--close .icon { transform: rotate(45deg); }
.lightbox__btn--prev { left: 24px; top: 50%; transform: translateY(-50%); }
.lightbox__btn--prev .icon { transform: rotate(180deg); }
.lightbox__btn--next { right: 24px; top: 50%; transform: translateY(-50%); }
.lightbox.is-single .lightbox__btn--prev, .lightbox.is-single .lightbox__btn--next { display: none; }
/* The flying copy during open and close (FLIP), above everything. */
.lightbox-fly { position: fixed; z-index: 95; left: 0; top: 0; object-fit: cover; pointer-events: none; transform-origin: 0 0; will-change: transform; }

/* ---------- Tablet ---------- */
@media (max-width: 1080px) {
  .type-tile { grid-column: span 6; }
  .type-tile:last-child { grid-column: 1 / -1; }
  .orbit-build__stage { grid-column: 1 / -1; max-width: 560px; justify-self: start; }
  .orbit-build__text { grid-column: 1 / -1; margin-top: var(--space-4); }
}

/* ---------- Phone: every work its own card in the flow, pictures first ---------- */
@media (max-width: 640px) {
  .catbar { top: calc(var(--nav-h) + 8px); bottom: auto; max-width: calc(100% - 2 * var(--margin)); transform: translate(-50%, -16px); }
  .catbar__link { padding: 0 11px; font-size: 0.875rem; gap: 6px; min-height: 44px; }
  .catbar__link .tnum { display: none; }
  .gallery { grid-template-columns: minmax(0, 1fr); row-gap: var(--space-6); }
  .work { min-width: 0; grid-template-columns: minmax(0, 1fr); }
  .work, .type-tile, .piece--wide, .piece--tall, .piece--half, .piece--panorama { grid-column: 1; }
  .work__name { font-size: clamp(1.75rem, 9vw, 2.25rem); }
  .work__open { width: 44px; height: 44px; right: 12px; top: 12px; }
  .work__phone { width: 26%; }
  .work--empty { grid-template-columns: 72px 1fr; align-items: center; gap: var(--space-3); aspect-ratio: auto; padding: var(--space-4); }
  .work__ring { width: 72px; }
  .work__empty { font-size: 1.5rem; }
  .type-tile { min-height: 300px; padding: var(--space-3); }
  .type-tile__name { font-size: calc(100cqw / 4.6); }
  .piece--tall .work__media { aspect-ratio: 4 / 5; }
  .orbit-build { margin-bottom: var(--space-7); }
  .orbit-build__stage { max-width: none; }
  .om { width: 20px; height: 20px; margin: -10px 0 0 -10px; font-size: 0.625rem; }
  .lightbox__figure { padding: 64px 0 16px; }
  .lightbox__bar { padding: var(--space-2) 150px 0 var(--margin); flex-direction: column; gap: 4px; }
  .lightbox__btn--prev, .lightbox__btn--next { top: auto; bottom: 16px; transform: none; }
  .lightbox__btn--prev { left: auto; right: 80px; }
  .lightbox__btn--next { right: 16px; }
  .lightbox__btn--close { top: 8px; right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .work__media > img, .work__open, .lightbox__btn, .catbar, .catbar__link, .peek__card, .peek__card img { transition-duration: 0ms; }
}
