/* =====================================================
   WORK — portfolio page: editorial bento grid,
   segmented filter and lightbox. Uses site.css tokens.
   ===================================================== */

*, *::before, *::after { box-sizing: border-box; }
body.page-work {
  margin: 0;
  background: var(--site-bg);
  color: var(--site-text);
  font-family: var(--site-font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
:where(.page-work) :is(h1, h2, h3, p, figure) { margin: 0; }
:where(.page-work) img { display: block; max-width: 100%; }

.work {
  max-width: var(--site-max);
  margin: 0 auto;
  padding: clamp(2rem, 4vw, 3rem) var(--site-gutter) clamp(4rem, 8vw, 6.5rem);
}

/* ── Toolbar ────────────────────────────────────────── */
.work__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap;
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
}

/* ── Bento grid ─────────────────────────────────────── */
.bento {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-areas:
    "i i i i i i i i i i i i"
    "h h h h h h h h b b b b"
    "a a a a a a d d d e e e"
    "f f f f f f g g g g g g";
  gap: clamp(1rem, 1.8vw, 1.5rem);
  align-items: stretch;
}
.tile--h { grid-area: h; } .tile--a { grid-area: a; } .tile--b { grid-area: b; } 
.tile--d { grid-area: d; } .tile--e { grid-area: e; } .tile--f { grid-area: f; } .tile--g { grid-area: g; }
.tile--i { grid-area: i; }

/* Filtered views drop the composition for an even grid */
.bento.is-filtered {
  grid-template-areas: none;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
}
.bento.is-filtered .tile { grid-area: auto; }
.bento.is-filtered .tile--i { grid-column: 1 / -1; }
.tile[hidden] { display: none; }

/* ── Tile: image on top, caption on white below ─────── */
.tile {
  min-width: 0;
  display: flex;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  animation: tile-in 0.5s var(--site-ease) both;
}
@keyframes tile-in { from { opacity: 0; transform: translateY(10px); } }
.tile__link {
  position: relative;
  display: flex; flex-direction: column; flex: 1;
  width: 100%; min-width: 0;
  padding: 0; border: 0; background: none;
  color: inherit; text-align: left; font: inherit;
  text-decoration: none; cursor: pointer;
}
.tile__link:focus-visible { outline: 3px solid var(--site-orange); outline-offset: -3px; border-radius: 16px; }

.tile__media {
  position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden;
  background: var(--site-surface);
  border-bottom: var(--site-stroke);
}
.tile__media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tile__media--site { aspect-ratio: 16 / 10; }
.tile__media--site img { object-position: left top; }
.tile__media--poster { aspect-ratio: 3 / 4; }
.tile__media--product {
  aspect-ratio: 4 / 3.4;
  background: radial-gradient(circle at 50% 38%, #fbf8f4 0%, #ece4da 70%, #ddd2c4 100%);
}
/* Absolutely placed so the whole garment fits inside the frame */
.tile__media--product img {
  position: absolute; inset: 5%; width: 90%; height: 90%;
  object-fit: contain; filter: drop-shadow(0 14px 20px rgba(35, 61, 77, 0.18));
}

/* Video tile: caption in two columns above a full-width player */
.tile--i { flex-direction: column; }
.tile__media--video {
  flex: none; aspect-ratio: 1280 / 666; background: var(--site-ink-deep);
  border-top: var(--site-stroke); border-bottom: 0;
}
.tile__media--video video { display: block; width: 100%; height: 100%; object-fit: contain; }

.tile__info { padding: 1.1rem 1.25rem 1.3rem; }
.tile--i .tile__info {
  display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
  gap: 1.25rem clamp(2rem, 4vw, 3.5rem); padding: clamp(1.25rem, 2.5vw, 2rem);
}
.tile__meta { display: grid; gap: 0.6rem; margin: 0 0 1.1rem; }
.tile__meta dt { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--site-text-3); }
.tile__meta dd { margin: 0.1rem 0 0; font-size: 0.92rem; color: var(--site-ink); }
.tile__kicker {
  display: flex; align-items: center; gap: 0.6rem; margin: 0;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--site-text-3);
}
.tile__live { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--site-orange-ink); letter-spacing: 0.08em; }
.tile__live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tile__title {
  margin: 0.4rem 0 0;
  font-family: var(--site-display); font-weight: 700;
  font-size: clamp(1.05rem, 1.5vw, 1.25rem); line-height: 1.25; letter-spacing: -0.015em;
  color: var(--site-ink);
}
.tile--a .tile__title { font-size: clamp(1.25rem, 2vw, 1.6rem); }
.tile__desc { margin: 0.5rem 0 0; font-size: 0.92rem; line-height: 1.6; color: var(--site-text-2); }


/* ── Lightbox ───────────────────────────────────────── */
.lightbox {
  width: min(1100px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0; border: 1px solid var(--site-line-2); border-radius: 18px;
  background: #f5f7f8; color: var(--site-text);
  overflow: hidden;
}
.lightbox::backdrop { background: rgba(6, 12, 16, 0.82); backdrop-filter: blur(4px); }
.lightbox[open] { animation: lb-in 0.3s var(--site-ease); }
@keyframes lb-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
.lightbox__figure {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  max-height: calc(100vh - 2rem);
}
.lightbox__stage {
  display: grid; place-items: center;
  padding: 1.5rem;
  background: radial-gradient(circle at 50% 40%, #f5f7f8, #f5f7f8 75%);
  min-height: 0;
}
.lightbox__stage.is-product { background: radial-gradient(circle at 50% 38%, #fbf8f4 0%, #ece4da 70%, #ddd2c4 100%); }
.lightbox__img { max-width: 100%; max-height: calc(100vh - 5rem); object-fit: contain; border-radius: 6px; }
.lightbox__caption {
  padding: clamp(1.5rem, 3vw, 2.5rem);
  display: flex; flex-direction: column; justify-content: flex-end; gap: 0.75rem;
  border-left: 1px solid var(--site-line);
}
.lightbox__caption .tile__kicker { color: var(--site-orange); }
.lightbox__title { font-family: var(--site-display); font-weight: 700; font-size: clamp(1.4rem, 2.4vw, 2rem); line-height: 1.2; color: #233D4D; }
.lightbox__desc { color: var(--site-text-2); line-height: 1.7; }
.lightbox__close {
  position: absolute; top: 0.9rem; right: 0.9rem;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--site-line-2); background: rgba(255,255,255, 0.85);
  color: #233D4D; font-size: 1rem; cursor: pointer;
  transition: background 0.2s ease;
}
.lightbox__close:hover { background: var(--site-orange); border-color: var(--site-orange); }
.lightbox__close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
body.has-lightbox { overflow: hidden; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 1024px) {
  .bento {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-areas:
      "i i i i i i"
      "h h h h h h"
      "a a a a a a"
      "b b d d e e"
      "f f f g g g";
  }
}
@media (max-width: 640px) {
  .bento, .bento.is-filtered { grid-template-columns: 1fr; grid-template-areas: none; }
  .bento .tile { grid-area: auto; }
  .tile--i .tile__info { grid-template-columns: minmax(0, 1fr); }
  .seg { width: 100%; }
  .seg__btn { flex: 1; padding: 0.6rem 0.5rem; }
  .lightbox__figure { grid-template-columns: 1fr; overflow-y: auto; }
  .lightbox__caption { border-left: 0; border-top: 1px solid var(--site-line); }
  .lightbox__img { max-height: 60vh; }
}
@media (prefers-reduced-motion: reduce) {
  .tile, .lightbox[open] { animation: none; }
  .seg__indicator { transition: none; }
}
