/* ===========================================================================
 * Artwork cards + modal carousel
 * ===========================================================================
 * Namespaced `aw-` throughout and kept in its own file rather than folded into
 * does-cloud-compute.css, for the same reason the editor keeps slot prefixes
 * apart: this is going on more than one exhibition page, and the artwork grid
 * must not inherit or fight the artists grid's rules when they sit next to
 * each other on the same page.
 *
 * Visual language is borrowed from does-cloud-compute.css deliberately —
 * 1px/2px white rules, 4px radius, IBM Plex Mono, --rule/--muted/--ink — so it
 * reads as the same page. It does NOT borrow from past-events.css, which is a
 * different page with a different design language.
 *
 * The modal is its own component, not .pc-lightbox. .pc-lightbox is a
 * page-level browser for loose gallery images; this is a per-artwork carousel
 * with thumbnail navigation. They coexist on the DCCeP page — hence the
 * separate z-index band and the separate class tree.
 * =========================================================================== */

/* Fallbacks so the file works on a page that doesn't define the site vars. */
.aw-grid,
.aw-modal {
  --aw-rule: var(--rule, #2a2a2d);
  --aw-ink: var(--ink, #e8e8ec);
  --aw-muted: var(--muted, #b0b0bb);
}

/* ── Grid ────────────────────────────────────────────────────────────── */
.aw-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin: 0;
}

@media (max-width: 900px) { .aw-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .aw-grid { grid-template-columns: 1fr; } }

.aw-empty { color: var(--muted, #b0b0bb); }

/* ── Condensed card ──────────────────────────────────────────────────── */
.aw-card { margin: 0; }

/* The whole card is the button: one click target, one hover target, one focus
   target. Resetting the UA button styling rather than wrapping a div in an
   onclick keeps it keyboard-operable for free. */
.aw-card__open {
  display: block;
  width: 100%;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.aw-card__open:hover,
.aw-card__open:focus-visible {
  transform: translateY(-3px);
  border-color: #fff;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .55);
  outline: none;
}

.aw-card__open:focus-visible { outline: 2px solid var(--aw-ink); outline-offset: 3px; }

.aw-figure { margin: 0; display: block; }

.aw-cover {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;          /* square main cover, per the brief */
  object-fit: cover;
  background: #111;
}

.aw-cover--empty { display: block; width: 100%; aspect-ratio: 1 / 1; background: #141416; }

.aw-figcaption {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .75rem 1rem 1rem;
  border-top: 1px solid var(--aw-rule);
}

.aw-card__title { font-size: 1.05rem; line-height: 1.25; }
.aw-card__artist { font-size: .85rem; color: var(--aw-muted); }

/* ── Stowed detail ───────────────────────────────────────────────────── */
/* Baked into the card and hidden until the modal moves it. Not `hidden` and
   not `display:none` on a wrapper the modal also uses — the class is removed
   on open and re-added on close, so there is exactly one node either way. */
.aw-detail.is-stowed { display: none; }

.aw-detail { display: block; }

.aw-detail__head { margin: 0 0 1rem; }

.aw-detail__title {
  margin: 0;
  font-size: clamp(18px, 2.4vw, 26px);
  font-weight: 700;
  line-height: 1.2;
}

.aw-detail__artist { font-weight: 400; color: var(--aw-muted); }

.aw-detail__desc { margin: 1rem 0 .5rem; max-width: 70ch; line-height: 1.55; }
.aw-detail__meta { margin: .25rem 0; color: var(--aw-muted); font-size: .85rem; }
.aw-detail__link { margin: .5rem 0 0; }
.aw-detail__link a { color: var(--aw-ink); text-decoration: underline; }

/* The small faint caption line: title (year) © artist */
.aw-detail__credit {
  margin: 1rem 0 0;
  padding-top: .75rem;
  border-top: 1px solid var(--aw-rule);
  color: var(--aw-muted);
  font-size: .78rem;
  opacity: .8;
}

/* ── Carousel ────────────────────────────────────────────────────────── */
.aw-carousel { margin: 0; }

.aw-stage { position: relative; display: flex; align-items: center; justify-content: center; }

.aw-main {
  display: block;
  max-width: 100%;
  max-height: 58vh;
  width: auto;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.aw-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1.5px solid rgba(255, 255, 255, .85);
  background: rgba(0, 0, 0, .35);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.aw-nav:hover { background: rgba(255, 255, 255, .08); }
.aw-nav--prev { left: 8px; }
.aw-nav--next { right: 8px; }

/* ── Thumbnail strip ─────────────────────────────────────────────────── */
.aw-thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: .85rem 0 0;
}

.aw-thumb {
  width: 64px;
  height: 64px;
  padding: 0;
  border: 1px solid var(--aw-rule);
  background: none;
  cursor: pointer;
  opacity: .55;
  transition: opacity .15s ease, border-color .15s ease;
}

.aw-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.aw-thumb:hover { opacity: .85; }
.aw-thumb.is-current { opacity: 1; border-color: #fff; }

/* ── Modal shell ─────────────────────────────────────────────────────── */
/* z-index sits just below .pc-lightbox (9999) so that if a visitor somehow has
   both open, the loose-image lightbox wins — it is the more recently opened
   one in every path that can produce that state. */
.aw-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .88);
  z-index: 9900;
  padding: clamp(12px, 4vw, 40px);
}

.aw-modal[aria-hidden="false"] { display: flex; }

.aw-modal__inner {
  position: relative;
  width: min(1000px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  padding: clamp(16px, 3vw, 32px);
  border: 1px solid var(--rule, #2a2a2d);
  border-radius: 4px;
  background: var(--bg, #0b0b0c);
  color: var(--ink, #e8e8ec);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.aw-modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1.5px solid rgba(255, 255, 255, .85);
  background: rgba(0, 0, 0, .35);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.aw-modal__close:hover { background: rgba(255, 255, 255, .08); }

body.aw-modal-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .aw-card__open { transition: none; }
  .aw-card__open:hover, .aw-card__open:focus-visible { transform: none; }
}
