/*
 * tiles.css — ANZ v3 Tile Component
 *
 * Namespace: .anz-v3-tile
 * Covers: collection tiles, category tiles (home + collections)
 * All selectors scoped: body.anz-v3 .anz-v3-tile*
 * No hex values — var(--...) only.
 *
 * Phase 4 pages: home, collections
 * Provenance: IA spec §3.3 (Clear Skies Ultrasoft / Sand tile backgrounds),
 *             §4.3 (photography brief for collections/category tiles)
 */


/* ===================================================================
 * TILE GRID WRAPPER
 * =================================================================== */

body.anz-v3 .anz-v3-tile-grid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}


/* ===================================================================
 * BASE TILE
 * =================================================================== */

body.anz-v3 .anz-v3-tile {
  background-color: var(--bg-wash);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  text-decoration: none;
  transition:
    box-shadow var(--motion-standard) var(--motion-exit),
    transform var(--motion-standard) var(--motion-exit);
}

body.anz-v3 .anz-v3-tile:focus,
body.anz-v3 .anz-v3-tile:hover {
  box-shadow: var(--shadow-md);
  text-decoration: none;
  transform: translateY(-3px);
}

body.anz-v3 .anz-v3-tile:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}


/* ===================================================================
 * TILE IMAGE
 * =================================================================== */

body.anz-v3 .anz-v3-tile__image {
  aspect-ratio: 3 / 2;
  background-color: var(--surface-inverse);
  overflow: hidden;
  width: 100%;
}

body.anz-v3 .anz-v3-tile__image img {
  height: 100%;
  object-fit: cover;
  transition: transform var(--motion-standard) var(--motion-exit);
  width: 100%;
}

body.anz-v3 .anz-v3-tile:hover .anz-v3-tile__image img {
  transform: scale(1.04);
}


/* ===================================================================
 * TILE BODY
 * =================================================================== */

body.anz-v3 .anz-v3-tile__body {
  align-items: flex-start;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
}

body.anz-v3 .anz-v3-tile__label {
  color: var(--text);
  font-size: var(--type-h3-size);
  font-weight: var(--font-weight-medium);
  line-height: var(--type-h3-lh);
}

body.anz-v3 .anz-v3-tile__count {
  color: var(--text-muted);
  font-size: var(--type-body-s-size);
  line-height: var(--type-body-s-lh);
}


/* ===================================================================
 * TILE VARIANTS
 * Sand background — pairs with photography per IA spec §3.4
 * =================================================================== */

body.anz-v3 .anz-v3-tile--sand {
  background-color: var(--surface-warm);
}

body.anz-v3 .anz-v3-tile--sand .anz-v3-tile__label {
  color: var(--anz-pacific-blue);
}

/* Feature tile — larger hero-style tile */
body.anz-v3 .anz-v3-tile--feature {
  grid-column: span 2;
  min-height: 320px;
}

body.anz-v3 .anz-v3-tile--feature .anz-v3-tile__image {
  aspect-ratio: 16 / 9;
}

body.anz-v3 .anz-v3-tile--feature .anz-v3-tile__label {
  font-size: var(--type-h2-size);
  line-height: var(--type-h2-lh);
}


/* ===================================================================
 * RESPONSIVE
 * =================================================================== */

@media (max-width: 768px) {
  body.anz-v3 .anz-v3-tile-grid {
    gap: var(--space-4);
    grid-template-columns: repeat(2, 1fr);
  }

  body.anz-v3 .anz-v3-tile--feature {
    grid-column: span 2;
    min-height: 200px;
  }

  body.anz-v3 .anz-v3-tile:hover {
    transform: none;
  }
}

@media (max-width: 480px) {
  body.anz-v3 .anz-v3-tile-grid {
    grid-template-columns: 1fr;
  }

  body.anz-v3 .anz-v3-tile--feature {
    grid-column: span 1;
  }
}


/* ===================================================================
 * REDUCED MOTION
 * =================================================================== */

@media (prefers-reduced-motion: reduce) {
  body.anz-v3 .anz-v3-tile,
  body.anz-v3 .anz-v3-tile__image img {
    transition: none;
  }

  body.anz-v3 .anz-v3-tile:hover .anz-v3-tile__image img {
    transform: none;
  }

  body.anz-v3 .anz-v3-tile:focus,
  body.anz-v3 .anz-v3-tile:hover {
    transform: none;
  }
}
