/* ============================================================
   projects.css: personal projects (projects/*.html)
   Layout only; type and colour come from styles.css roles.
   ============================================================ */

/* ---------- Index ---------------------------------------- */
.lab-intro {
  padding: clamp(var(--space-12), 7vw, 5.5rem) 0;
}

.lab-list {
  padding-block: var(--space-section);
}

/* Group sub-header: a label above its projects */
.lab-group {
  margin: var(--space-16) 0 var(--space-2);
}

/* Project row: title | description | thumbnail */
.lab-project {
  display: grid;
  grid-template-columns: minmax(200px, .8fr) minmax(0, 1.2fr) minmax(240px, .9fr);
  align-items: start;
  gap: var(--space-split);
  margin: 0 calc(-1 * var(--space-4));
  padding: var(--space-6) var(--space-4);
  border-radius: var(--radius);
  color: var(--ink-muted);
  text-decoration: none;
  transition: background .2s ease;
}

.lab-project:hover {
  background: var(--accent-wash);
}

.lab-project .display-m {
  margin-bottom: var(--space-2);
  color: var(--ink);
}

.lab-project__former {
  display: block;
}

.lab-project__cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
  color: var(--accent);
}

.lab-project__cta span {
  transition: transform .2s var(--ease);
}

.lab-project:hover .lab-project__cta span {
  transform: translateX(4px);
}

.lab-project__copy {
  max-width: 48ch;
}

.lab-project__copy .tags {
  margin: var(--space-4) 0 0;
}

/* Thumbnail; --contain shows the whole screenshot, placeholder fills empty slots */
.lab-thumb {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.lab-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lab-thumb--contain img {
  padding: var(--space-3);
  object-fit: contain;
}

.lab-placeholder {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  padding: var(--space-5);
  background: linear-gradient(135deg, var(--paper), var(--white));
  color: var(--ink-faint);
}

.lab-placeholder b {
  color: var(--ink);
}

/* Statement (dark section) */
.lab-statement p {
  max-width: 48ch;
}

.lab-principles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5) var(--space-6);
  margin-top: var(--space-8);
}

.lab-principles .label {
  display: block;
  margin-bottom: var(--space-1);
  color: var(--white);
}

/* ---------- Project pages -------------------------------- */
.lab-hero {
  padding: var(--space-12) 0 var(--space-12);
  border-bottom: 1px solid var(--hair);
}

.lab-back {
  color: var(--accent);
  text-decoration: none;
}

.lab-hero h1 {
  max-width: 14ch;
}

.lab-hero .split {
  margin-top: var(--space-12);
}

/* Role / status / year list beside the hero */
.fact-list {
  border-top: 1px solid var(--hair);
}

.fact-list > div {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--hair);
}

.fact-list .label-sm {
  color: var(--ink-faint);
}

/* Label column + body column */
.lab-section {
  display: grid;
  grid-template-columns: minmax(150px, .36fr) minmax(0, 1fr);
  gap: var(--space-split);
}

.lab-section__body p {
  max-width: 68ch;
  color: var(--ink-muted);
}

/* Screenshot grid: half-width shots, --wide spans the row, --empty is a slot */
.shot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-top: var(--space-8);
}

.shot {
  min-height: 240px;
  overflow: hidden;
  border: 1px solid var(--hair);
  background: var(--surface);
}

.shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shot--wide {
  grid-column: 1 / -1;
}

.shot--empty {
  display: grid;
  place-items: center;
  color: var(--ink-faint);
  background: repeating-linear-gradient(45deg, var(--washed) 0 12px, var(--surface) 12px 24px);
}

/* ---------- Responsive ----------------------------------- */
@media (max-width: 900px) {
  .lab-section {
    grid-template-columns: 1fr;
  }

  /* Title and description stacked beside the thumbnail */
  .lab-project {
    grid-template-columns: minmax(0, 1fr) minmax(0, .8fr);
    column-gap: var(--space-6);
    row-gap: var(--space-4);
  }

  .lab-project .lab-thumb {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .shot-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .lab-project {
    grid-template-columns: minmax(0, 1fr);
  }

  .lab-project .lab-thumb {
    grid-column: 1;
    grid-row: auto;
  }

  .lab-principles {
    grid-template-columns: 1fr;
  }

  .fact-list > div {
    grid-template-columns: 82px 1fr;
  }
}

/* Updated projects index and product galleries. */
.projects-page .lab-intro--ruled {border-bottom:1px solid var(--hair);margin-bottom:3rem;}
.projects-page .lab-intro__title {max-width:14ch;}
.projects-page .lab-project--last {margin-bottom:3rem;}
.projects-page .lab-statement--ruled {border-top:1px solid var(--ink);}
.projects-page .is-hidden {display:none;}
.gallery-open {overflow:hidden;}
.product-gallery {box-sizing:border-box;width:calc(100% - 64px);max-width:1320px;max-height:calc(100dvh - 64px);margin:auto;padding:0;border:1px solid var(--ink);background:var(--white);color:var(--ink);overscroll-behavior:contain;}
.product-gallery::backdrop {background:rgba(14,16,20,.72);}
.product-gallery__header {position:sticky;top:0;z-index:1;display:flex;align-items:start;justify-content:space-between;gap:24px;padding:24px 32px;background:var(--white);border-bottom:1px solid var(--hair);}
.product-gallery__header h2 {margin:8px 0;}
.product-gallery__header p {margin:0;}
.product-gallery__close {flex-shrink:0;min-height:44px;padding:10px 14px;border:1px solid var(--ink);background:var(--white);color:var(--ink);cursor:pointer;}
.product-gallery__close:hover {background:var(--ink);color:var(--white);}
.product-gallery__grid {display:grid;grid-template-columns:repeat(auto-fit,minmax(0,280px));justify-content:center;gap:32px;padding:32px;}
.product-gallery__item {min-width:0;margin:0;}
.product-gallery__screen {box-sizing:border-box;display:block;width:100%;aspect-ratio:390/844;height:auto;border:2px solid var(--ink);border-radius:24px;object-fit:cover;background:var(--panel);}
.product-gallery__placeholder {display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;gap:12px;padding:20px;}
.product-gallery__placeholder p {font:400 16px/1.5 var(--body);color:var(--muted);margin:0;}
.product-gallery__item .caption {display:block;margin-top:12px;line-height:1.5;}
@media(min-width:721px) {
 .product-gallery__grid {display:flex;flex-wrap:wrap;justify-content:center;}
 .product-gallery__item {flex:0 1 calc((100% - 96px)/4);max-width:280px;}
}
@media(min-width:721px) and (max-width:980px) {
 .product-gallery__item {flex-basis:calc((100% - 32px)/2);}
}
@media(max-width:720px) {
 .product-gallery {width:100%;max-width:none;max-height:100dvh;height:100dvh;border:0;}
 .product-gallery__header {padding:20px;gap:12px;}
 .product-gallery__header h2 {font-size:24px;}
 .product-gallery__grid {display:flex;flex-wrap:nowrap;justify-content:flex-start;gap:20px;overflow-x:auto;padding:24px 20px;scroll-snap-type:x mandatory;scroll-padding-inline:20px;}
 .product-gallery__item {flex:0 0 min(78vw,320px);scroll-snap-align:start;}
}
@media(prefers-reduced-motion:reduce) {.product-gallery__grid {scroll-behavior:auto;}}

/* A single desktop capture retains its original proportions on every viewport. */
.product-gallery__grid:has(.product-gallery__item--desktop) {justify-content:center;}
.product-gallery__grid .product-gallery__item--desktop {flex:0 1 100%;width:100%;max-width:1120px;}
.product-gallery__screen--desktop {aspect-ratio:auto;height:auto;max-height:calc(100dvh - 240px);object-fit:contain;border:1px solid var(--hair);border-radius:0;background:var(--white);}
@media(max-width:720px) {
 .product-gallery__grid .product-gallery__item--desktop {flex:0 0 100%;max-width:100%;}
 .product-gallery__screen--desktop {max-height:none;}
}

/* Screenshot miniatures for the project index; source placeholders remain in HTML. */
.projects-page .lab-thumb {background:var(--panel);}
.lab-thumb__screens {display:flex;align-items:flex-start;justify-content:center;gap:12px;height:100%;padding:24px 16px 0;overflow:hidden;}
.lab-thumb__screens img {display:block;flex:0 0 28%;width:28%;height:auto;padding:0;object-fit:cover;border:1px solid var(--ink);border-radius:8px;}
.lab-thumb__screens img:nth-child(2) {margin-top:20px;}
.lab-thumb__screens--desktop {align-items:center;padding:20px;}
.lab-thumb__screens--desktop img {flex:0 1 100%;width:100%;height:auto;object-fit:contain;border-radius:0;}

/* One readable main screen per mobile product, cropped to its useful content. */
.lab-thumb__screens--mobile {position:relative;display:block;padding:0;}
.lab-thumb__screens--mobile img {position:absolute;inset:0;display:block;width:100%;height:100%;max-width:none;padding:0;border:0;border-radius:0;object-fit:cover;object-position:center 16%;}
.lab-thumb__screens--mobile.lab-thumb__screens--little-moments img {object-position:center 65%;}
.lab-thumb__screens--mobile.lab-thumb__screens--beerkonig img {object-position:center 9%;}
.lab-thumb__screens--mobile.lab-thumb__screens--on-the-road img {object-position:center 72%;}
.lab-thumb__screens--mobile.lab-thumb__screens--tankenwo img {object-position:center;}

/* Projects hero shares the About page's palette and section rail. */
.projects-page .lab-intro {background:var(--bg);color:var(--ink);}
.projects-page .lab-intro h1 {color:var(--ink);}
.projects-page .lab-intro .lead {color:var(--ink-2);}
.lab-intro__band {display:flex;justify-content:space-between;gap:16px;padding-bottom:20px;border-bottom:1px solid var(--ink);margin-bottom:40px;color:var(--muted);}
@media(max-width:720px) {
 .lab-intro__band {padding-bottom:14px;margin-bottom:20px;font-size:11px;}
}
.lab-thumb__screens--map-crop {display:block;position:relative;padding:0;}
.lab-thumb__screens--map-crop img {position:absolute;inset:0;width:100%;height:100%;padding:0;object-fit:cover;object-position:center;border:0;border-radius:0;}
