/* ───────────────────────────────────────────────────────────────────────────
   works.css — "کارەکانمان / Our Works" gallery.

   Three cards per row on desktop. Five made each photo about 220px wide, which
   is too small to actually show an installation; at three they are ~380px and
   the work is readable. Scales 3 → 2 → 1, so a phone gets one large photo
   rather than two cramped ones.

   Also supplies the .gallery-* rules used by the older about.html markup.
   Those class names were in the HTML but defined in NO stylesheet, so every
   photo rendered at its natural size — the "too expand" problem. Fixed here
   with real grid columns plus object-fit cropping.

   Works in RTL (Kurdish / Arabic) and LTR unchanged — CSS Grid and the
   inset-inline-* properties mirror with the document direction.
   ─────────────────────────────────────────────────────────────────────────── */

/* ── Page shell ─────────────────────────────────────────────────────────── */
.works-hero {
  background: linear-gradient(160deg, var(--bg) 0%, var(--bg-2) 55%, var(--bg) 100%);
  padding: 140px 0 76px;
  position: relative;
  overflow: hidden;
  text-align: center;
}
.works-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, var(--gold-a18) 0%, transparent 70%);
}
.works-hero-inner { position: relative; z-index: 1; }
.works-hero h1 {
  font-size: clamp(1.9rem, 5vw, 3.2rem);
  font-weight: 900;
  color: var(--ink);
  letter-spacing: -1px;
  margin-bottom: 12px;
  line-height: 1.25;
}
.works-hero h1 span { color: var(--gold-light); }
.works-hero p {
  font-size: 1.05rem;
  color: var(--ink-2);
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.75;
}

.works-hero-stats {
  display: flex;
  justify-content: center;
  margin: 36px auto 0;
  max-width: 480px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--gold-a08);
  backdrop-filter: blur(10px);
  overflow: hidden;
}
.works-hero-stats div {
  flex: 1;
  padding: 18px 14px;
  border-inline-end: 1px solid var(--line);
}
.works-hero-stats div:last-child { border-inline-end: none; }
.works-hero-stats .num {
  display: block;
  font-size: 1.65rem;
  font-weight: 900;
  color: var(--gold-light);
  line-height: 1.1;
}
.works-hero-stats .lbl {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .9px;
  font-weight: 600;
}

.works-section { padding: 52px 0 90px; background: var(--bg-2); min-height: 50vh; }

/* ── Category filter tabs ───────────────────────────────────────────────── */
.works-tabs {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 38px;
}
.works-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-2);
  cursor: pointer;
  transition: all .2s ease;
  font-family: inherit;
}
.works-tab:hover { border-color: var(--line-2); background: var(--surface-2); transform: translateY(-1px); }
.works-tab.active {
  background: var(--gold-grad);
  border-color: transparent;
  color: var(--ink-on-gold);
  box-shadow: var(--glow);
}
/* Count bubble — a separate element so applyTranslations(), which rewrites the
   innerHTML of anything carrying data-i18n, cannot wipe it on a language switch. */
.works-tab-count {
  font-style: normal;
  font-size: 11.5px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-3);
}
.works-tab.active .works-tab-count { background: rgba(26,19,5,.20); color: var(--ink-on-gold); }

/* ── THE GRID — 3 / 2 / 1 ───────────────────────────────────────────────── */
.works-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px;
}
@media (max-width: 1023px) { .works-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; } }
@media (max-width: 639px)  { .works-grid { grid-template-columns: 1fr; gap: 18px; } }

/* ── Work card ──────────────────────────────────────────────────────────── */
.work-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform .3s cubic-bezier(.2, .8, .2, 1),
              box-shadow .3s ease,
              border-color .3s ease;
}
.work-card:hover,
.work-card:focus-visible {
  transform: translateY(-7px);
  box-shadow: var(--shadow-lg);
  border-color: var(--line-2);
  outline: none;
}

/* Fixed aspect box + cover cropping: a 4000px phone photo and a small JPEG
   fill exactly the same tile, so one oversized upload can't stretch its row. */
.work-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--surface-2);
}
.work-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .55s cubic-bezier(.2, .8, .2, 1);
}
.work-card:hover .work-thumb img { transform: scale(1.07); }

@supports not (aspect-ratio: 3 / 2) {
  .work-thumb { height: 0; padding-bottom: 66.66%; }
  .work-thumb img { position: absolute; inset: 0; }
}

/* Scrim so the category chip stays readable over a bright photo */
.work-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,.45) 0%, transparent 34%);
  pointer-events: none;
}

.work-cat {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  z-index: 1;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-on-gold);
  letter-spacing: .3px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .22);
}
.work-cat.solar    { background: var(--gold-grad-2); color: var(--ink-on-gold); }
.work-cat.internet { background: linear-gradient(135deg, var(--gold-light), var(--gold)); color: var(--ink-on-gold); }
.work-cat.camera   { background: linear-gradient(135deg, var(--gold-dark), var(--gold-deep)); color: var(--gold-light); }
.work-cat.other    { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line-2); }

.work-body {
  padding: 16px 18px 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.work-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.work-location {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold-light);
}
.work-location svg { width: 14px; height: 14px; flex-shrink: 0; }

.work-desc {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.work-date {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.work-date svg { width: 13px; height: 13px; }

@media (max-width: 639px) {
  .work-title { font-size: 17px; }
  .work-desc  { -webkit-line-clamp: 3; }
}

/* ── Empty / loading states ─────────────────────────────────────────────── */
.works-empty { text-align: center; padding: 70px 20px; color: var(--ink-3); }
.works-empty .icon { font-size: 46px; margin-bottom: 14px; }
.works-empty h3 { font-size: 17px; color: var(--ink-2); margin-bottom: 6px; font-weight: 800; }
.works-empty p { font-size: 14px; }

.works-skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: works-shimmer 1.3s infinite;
  border-radius: 20px;
  aspect-ratio: 3 / 2;
}
@keyframes works-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .works-skeleton { animation: none; }
  .work-card, .work-thumb img { transition: none; }
}

/* ── Lightbox ───────────────────────────────────────────────────────────── */
.works-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(5,4,3,.93);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: works-fade .18s ease-out;
}
@keyframes works-fade { from { opacity: 0; } to { opacity: 1; } }

.wl-inner {
  max-width: 1000px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line-2);
}
.wl-img {
  width: 100%;
  max-height: 64vh;
  object-fit: contain;
  background: var(--bg);
  display: block;
}
.wl-info { padding: 20px 24px 24px; }
.wl-info h3 { color: var(--ink); font-size: 20px; font-weight: 800; margin-bottom: 10px; }
.wl-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.wl-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--gold-a08);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
}
.wl-chip svg { width: 13px; height: 13px; }
.wl-info p { color: var(--ink-3); font-size: 14px; line-height: 1.75; }

.wl-close {
  position: absolute;
  top: 18px;
  inset-inline-end: 18px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: var(--gold-a12);
  color: var(--gold-light);
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}
.wl-close:hover { background: var(--gold-a30); }

.wl-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: var(--gold-a12);
  color: var(--gold-light);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}
.wl-nav:hover { background: var(--gold-a30); }
.wl-prev { inset-inline-start: 16px; }
.wl-next { inset-inline-end: 16px; }
@media (max-width: 767px) { .wl-nav { display: none; } }

/* ── Staff-only "add photos" panel ──────────────────────────────────────── */
.works-cta {
  margin-top: 40px;
  padding: 24px;
  border: 1px dashed var(--line-2);
  border-radius: 18px;
  background: var(--surface);
  text-align: center;
}
.works-cta h4 { font-size: 15px; font-weight: 800; color: var(--ink); margin-bottom: 6px; }
.works-cta p  { font-size: 13px; color: var(--ink-3); line-height: 1.6; margin-bottom: 14px; }
.works-cta-actions { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; }
.works-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 20px;
  border-radius: 12px;
  background: var(--gold-grad);
  color: var(--ink-on-gold);
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--glow);
}
.works-cta-btn:hover { filter: brightness(1.08); }
.works-cta-link { font-size: 13px; font-weight: 600; color: var(--gold-light); text-decoration: none; }
.works-cta-link:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════════════════
   LEGACY GALLERY MARKUP (.gallery-*)
   Kept in step with the grid above so any page still using the old
   gallery-item markup renders identically instead of full-bleed.
   ═══════════════════════════════════════════════════════════════════════════ */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin-top: 34px;
}
@media (max-width: 1023px) { .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 639px)  { .gallery-grid { grid-template-columns: 1fr; } }

.gallery-item {
  position: relative;
  aspect-ratio: 3 / 2;
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
@supports not (aspect-ratio: 3 / 2) {
  .gallery-item { height: 0; padding-bottom: 66.66%; }
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .55s cubic-bezier(.2, .8, .2, 1);
}
.gallery-item:hover img { transform: scale(1.07); }

.gi-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 14px;
  background: linear-gradient(to top, rgba(0,0,0,.88) 0%, rgba(0,0,0,.30) 46%, transparent 76%);
  opacity: 0;
  transition: opacity .28s ease;
}
.gallery-item:hover .gi-overlay { opacity: 1; }
@media (hover: none) { .gi-overlay { opacity: 1; } }

.gi-cat {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--ink-on-gold);
  margin-bottom: 6px;
  background: var(--gold-a45);
  backdrop-filter: blur(6px);
}
.gi-cat.solar    { background: var(--gold-grad-2); color: var(--ink-on-gold); }
.gi-cat.internet { background: linear-gradient(135deg, var(--gold-light), var(--gold)); color: var(--ink-on-gold); }
.gi-cat.camera   { background: linear-gradient(135deg, var(--gold-dark), var(--gold-deep)); color: var(--gold-light); }

.gi-label {
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.4;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .5);
}
