/* =====================================================================
   Portfolio page — work grids + lightbox (extends skills.css)
   ===================================================================== */

.work {
  display: grid;
  gap: 56px;
  max-width: 1160px;
  margin-inline: auto;
}

.card--work {
  padding-bottom: 18px;
}

/* ---------- 5-up grid ---------- */
.work-grid {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 24px;
}

.work-item {
  display: block;
  width: 100%;
  aspect-ratio: 188 / 130;
  padding: 0;
  border: 0;
  border-radius: 16px;
  overflow: hidden;
  background: #101020;
  cursor: zoom-in;
  position: relative;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.22),
    inset 0 -3px 0 rgba(0, 0, 0, 0.35),
    0 14px 26px -14px rgba(0, 0, 0, 0.7);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.work-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  transition: transform 0.4s ease;
}

/* Logo previews are 3:2 compositions centred on the mark */
.work-grid[data-gallery="Logofolio"] .work-item img {
  object-position: center;
}

/* Keep the bevel above the image */
.work-item::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.22),
    inset 0 -3px 0 rgba(0, 0, 0, 0.35),
    inset 0 2px 0 rgba(255, 255, 255, 0.14);
}

.work-item:hover,
.work-item:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 22px 34px -14px rgba(0, 0, 0, 0.8);
}

.work-item:hover img {
  transform: scale(1.04);
}

.work-item:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/* Small "expand" hint on hover */
.work-item::before {
  content: "";
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(10, 10, 10, 0.75) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7'/></svg>") center / 14px no-repeat;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1;
}

.work-item:hover::before,
.work-item:focus-visible::before {
  opacity: 1;
  transform: none;
}

/* ---------- Lightbox (native <dialog>) ---------- */
.lightbox {
  width: min(1200px, calc(100vw - 32px));
  max-width: none;
  height: min(92vh, 1000px);
  max-height: none;
  margin: auto;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: linear-gradient(180deg, #17142c 0%, #0f0d1c 100%);
  color: #fff;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.8),
    0 40px 90px -30px rgba(0, 0, 0, 0.9);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.lightbox[open] {
  display: flex;
  animation: lb-in 0.22s ease;
}

.lightbox::backdrop {
  background: rgba(8, 6, 18, 0.72);
  backdrop-filter: blur(6px);
}

@keyframes lb-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Title bar, same language as the window cards */
.lightbox__bar {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  min-height: 52px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  flex: none;
}

.lightbox__lights {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff5f57;
  box-shadow: 20px 0 0 #febc2e, 40px 0 0 #28c840;
  margin-right: 40px;
}

.lightbox__meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  justify-self: center;
  font-size: 15px;
}

.lightbox__meta strong {
  font-weight: 700;
  white-space: nowrap;
}

.lightbox__meta span {
  color: var(--lavender, #cdbcff);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lightbox__count {
  color: var(--lavender, #cdbcff);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.lightbox__close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.lightbox__close:hover {
  background: rgba(255, 255, 255, 0.16);
}

.lightbox__body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
}

.lightbox__scroll {
  overflow: auto;
  height: 100%;
  padding: 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.lightbox__img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.8);
}

/* Square logos should not be blown up to 1150px */
.lightbox--logo .lightbox__img {
  max-width: 760px;
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(10, 10, 20, 0.7);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(255, 255, 255, 0.15);
  transition: background-color 0.2s ease, transform 0.2s ease;
  z-index: 2;
}

.lightbox__nav:hover {
  background: rgba(107, 77, 255, 0.85);
}

.lightbox__nav--prev {
  left: 14px;
}

.lightbox__nav--next {
  right: 14px;
}

.lightbox__nav:focus-visible,
.lightbox__close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Lock page scroll while the dialog is open */
body.lightbox-open {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .lightbox[open] {
    animation: none;
  }
  .work-item,
  .work-item img {
    transition: none;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .work-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
  }
}

@media (max-width: 820px) {
  .work-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }

  .work-item {
    border-radius: 12px;
  }

  .lightbox {
    width: calc(100vw - 16px);
    height: calc(100dvh - 16px);
    border-radius: 14px;
  }

  .lightbox__meta {
    justify-self: start;
  }

  .lightbox__meta span,
  .lightbox__count {
    display: none;
  }

  .lightbox__lights {
    margin-right: 34px;
  }

  .lightbox__scroll {
    padding: 12px;
  }

  .lightbox__nav {
    width: 40px;
    height: 40px;
    top: auto;
    bottom: 14px;
    transform: none;
  }
}

@media (max-width: 480px) {
  .work-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
