/* =========================================================
   art-collection.css - Art Collection section (home preview + full page)
   Responsive, mobile-first. Uses the colours and fonts already
   defined in styles.css. Class names are unchanged.
   Breakpoints: 480 / 700 / 1000 / 1280, plus short-landscape.
   ========================================================= */

/* ---------- Home section ---------- */
.art-section .section-heading { align-items: flex-end; flex-wrap: wrap; gap: 12px 24px; }
.art-section .section-heading > p { flex: 1 1 260px; max-width: 380px; font-size: clamp(13px, 1.6vw, 14px); line-height: 1.8; margin: 0; }
.ac-more { display: flex; justify-content: center; margin-top: clamp(24px, 4vw, 34px); }
.ac-more .festival-button { min-height: 48px; padding-inline: clamp(20px, 5vw, 30px); border-color: var(--hero-accent); color: var(--hero-accent); font-size: 14px; max-width: 100%; text-align: center; }
.ac-more .festival-button:hover { background: var(--hero-accent); color: var(--on-image); border-color: var(--hero-accent); }
@media (max-width: 479px) { .ac-more .festival-button { width: 100%; } }

/* ---------- Grid ---------- */
/* 2 columns on phones, 3 on tablets, 4 on desktop (full page) */
.ac-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: stretch; }
@media (min-width: 480px)  { .ac-grid { gap: 14px; } }
@media (min-width: 700px)  { .ac-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; } }
@media (min-width: 1000px) { .ac-grid { gap: 24px; } .ac-grid--full { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1500px) { .ac-grid--full { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
/* very narrow phones: single column so text never gets squeezed */
@media (max-width: 339px)  { .ac-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Card ---------- */
.ac-card { --c: var(--red); display: flex; flex-direction: column; width: 100%; min-width: 0; padding: 0; text-align: left; font: inherit; color: inherit; border: 1px solid var(--border); border-radius: 10px; background: var(--card); overflow: hidden; cursor: zoom-in; transition: transform .3s, box-shadow .3s; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.ac-card:nth-child(3n+2) { --c: var(--blue); }
.ac-card:nth-child(3n)   { --c: var(--yellow); }
.ac-card[hidden] { display: none; }
.ac-card:focus-visible { transform: translateY(-4px); box-shadow: var(--shadow-glow); outline: 2px solid var(--hero-accent); outline-offset: 2px; }
/* hover lift only on devices that really hover (no sticky hover on touch) */
@media (hover: hover) { .ac-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-glow); } }
.ac-card:active { transform: scale(.985); }
.ac-frame { display: block; aspect-ratio: 4 / 5; padding: clamp(6px, 1.5vw, 10px); background: var(--muted); }
.ac-frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
.ac-info { display: grid; gap: 4px; margin: 0; padding: 10px 10px 12px; border-top: 3px solid var(--c); }
.ac-row { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 6px; font-size: 12px; line-height: 1.45; }
.ac-row dt { padding-top: 2px; font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-foreground); }
.ac-row dd { margin: 0; overflow-wrap: anywhere; }
.ac-row--artist dd { font-family: var(--font-heading); font-size: clamp(15px, 4.2vw, 18px); font-weight: 600; line-height: 1.25; }
@media (min-width: 480px) { .ac-info { gap: 6px; padding: 14px 14px 16px; } .ac-row { grid-template-columns: 56px minmax(0, 1fr); gap: 8px; font-size: 12.5px; } .ac-row dt { font-size: 9.5px; letter-spacing: .12em; } }
@media (min-width: 700px) { .ac-info { padding: 16px 18px 18px; } .ac-row { grid-template-columns: 64px minmax(0, 1fr); font-size: 13.5px; } .ac-row--artist dd { font-size: 18px; } }

/* ---------- Full page ---------- */
.ac-page { width: 100%; max-width: 1280px; margin-inline: auto; padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); }
@media (min-width: 1500px) { .ac-page { max-width: 1520px; } }
.ac-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px 24px; flex-wrap: wrap; margin-bottom: clamp(18px, 3vw, 26px); }
.ac-search { flex: 1 1 260px; width: 100%; max-width: 460px; min-height: 48px; padding: 0 18px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); font: inherit; font-size: 16px; /* 16px stops iOS zooming on focus */ color: var(--foreground); }
.ac-search:focus { outline: 2px solid var(--hero-accent); outline-offset: 2px; }
.ac-count { font-size: 13px; font-weight: 600; color: var(--muted-foreground); }
.ac-empty { padding: 40px 0; text-align: center; color: var(--muted-foreground); }
.ac-empty[hidden] { display: none; }
@media (max-width: 599px) {
  .ac-search { max-width: none; flex-basis: 100%; }
  .ac-count { width: 100%; }
}

/* ---------- Viewer (opens when an artwork is tapped) ---------- */
.ac-lightbox { width: min(96vw, 1000px); max-width: 100%; max-height: 92vh; max-height: 92dvh; margin: auto; padding: 0; border: 0; border-radius: 14px; background: var(--card); color: var(--foreground); overflow: hidden; box-shadow: var(--shadow-modal); }
.ac-lightbox::backdrop { background: rgba(10, 14, 18, .78); backdrop-filter: blur(4px); }
.ac-lb-body { display: grid; grid-template-columns: minmax(0, 1fr); max-height: 92vh; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.ac-lb-media { position: relative; display: grid; place-items: center; min-height: 220px; background: var(--muted); }
.ac-lb-media img { display: block; width: 100%; height: 100%; max-height: 60vh; max-height: 60dvh; object-fit: contain; }
.ac-lb-info { display: grid; gap: 10px; padding: 18px 18px calc(22px + env(safe-area-inset-bottom)); align-self: center; min-width: 0; }
.ac-lb-count { font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--red); }
.ac-lb-info .ac-info { padding: 0; border: 0; gap: 10px; }
.ac-lb-info .ac-row { font-size: 14.5px; grid-template-columns: 64px minmax(0, 1fr); }
.ac-lb-info .ac-row--artist dd { font-size: clamp(21px, 6vw, 26px); }
.ac-lb-close, .ac-lb-nav { position: absolute; z-index: 3; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .94); color: #111; font-size: 26px; line-height: 1; cursor: pointer; box-shadow: 0 3px 14px rgba(0, 0, 0, .25); touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.ac-lb-close { top: 10px; right: 10px; font-size: 24px; }
.ac-lb-nav { top: 50%; translate: 0 -50%; }
.ac-lb-prev { left: 8px; } .ac-lb-next { right: 8px; }
.ac-lb-close:focus-visible, .ac-lb-nav:focus-visible { outline: 2px solid var(--hero-accent); outline-offset: 2px; }
@media (hover: hover) { .ac-lb-close:hover, .ac-lb-nav:hover { background: var(--hero-accent); color: #fff; } }
.ac-lb-close:active, .ac-lb-nav:active { background: var(--hero-accent); color: #fff; }

/* Tablet and desktop: image left, details right */
@media (min-width: 800px) {
  .ac-lightbox { width: min(92vw, 1000px); }
  .ac-lb-body { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); overflow: hidden; }
  .ac-lb-media img { max-height: 88vh; max-height: 88dvh; }
  .ac-lb-info { padding: 30px 28px; overflow-y: auto; max-height: 88vh; max-height: 88dvh; }
  .ac-lb-info .ac-row { font-size: 15px; grid-template-columns: 70px minmax(0, 1fr); }
  .ac-lb-nav { width: 48px; height: 48px; }
}

/* Phones turned sideways (short screens): keep side-by-side layout */
@media (max-height: 520px) and (orientation: landscape) {
  .ac-lightbox { width: 96vw; max-height: 96vh; max-height: 96dvh; }
  .ac-lb-body { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); max-height: 96vh; max-height: 96dvh; overflow: hidden; }
  .ac-lb-media { min-height: 0; }
  .ac-lb-media img { max-height: 92vh; max-height: 92dvh; }
  .ac-lb-info { padding: 16px 18px; overflow-y: auto; max-height: 96vh; max-height: 96dvh; }
  .ac-lb-info .ac-row--artist dd { font-size: 20px; }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .ac-card { transition: none; }
  .ac-card:hover, .ac-card:focus-visible, .ac-card:active { transform: none; }
}
