/* ArtChiado — grelha A/B da homepage (12 projectos)
   Ficheiro novo: site/templates/styles/grid.css
   Ligar no head.php a seguir ao banner.css.
   Tudo está sob .acg (e .acg-*) para não interferir com o resto do sítio.
   O html do sítio usa font-size: 10px, por isso os tamanhos (e os rem do
   ynottony) estão em px ou vw — 1rem no ynottony = 16px (html sem font-size).

   Medidas copiadas de ynottony.co.uk/pages/packaging-designer-portfolio
   (portfolio-hub.css, 2026-12-01):
   - contentor: max 88rem = 1408px, calha lateral 1rem = 16px
   - calha entre cartões: clamp(.55rem, .85vw, .85rem) = clamp(8.8px, .85vw, 13.6px)
   - cantos: clamp(.85rem, 1.15vw, 1.2rem) = clamp(13.6px, 1.15vw, 19.2px)
     no telemóvel (≤599px): 1rem = 16px
   - fundo do bloco no ynottony: padding-bottom clamp(2rem, 5vw, 5rem)
   A estrutura A/B, as classes, o hover, o fundo e o 16:9 / vertical a esticar
   mantêm-se; só mudam as medidas. */

.acg {
  --acg-gutter: clamp(8.8px, 0.85vw, 13.6px);
  --acg-radius: clamp(13.6px, 1.15vw, 19.2px);
  --acg-shell-max: 1408px; /* 88rem */
  --acg-shell-gutter: 16px; /* 1rem */
  --acg-ease: cubic-bezier(.2, .72, .2, 1);
  --acg-yellow: #F8D648;
  --acg-yellow-hover: #E8C230;
  --acg-ink: #171717;
  --acg-card-bg: #e8e6df;
  box-sizing: border-box;
  width: 100%;
  max-width: calc(var(--acg-shell-max) + 2 * var(--acg-shell-gutter)); /* 1440px */
  margin: 0 auto;
  padding: 28px var(--acg-shell-gutter) clamp(32px, 5vw, 80px);
}

.acg *,
.acg *::before,
.acg *::after { box-sizing: border-box; }

/* ---------- Estrutura: A (2 paisagem 16:9) + B (1 vertical + 2 empilhadas) ---------- */

.acg .acg-grid {
  display: flex;
  flex-direction: column;
  gap: var(--acg-gutter);
}

.acg .acg-block {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--acg-gutter);
}

@media (min-width: 600px) {
  .acg .acg-block--a,
  .acg .acg-block--b {
    grid-template-columns: 1fr 1fr;
  }
  .acg .acg-block--b {
    grid-template-rows: auto auto;
    align-items: stretch;
  }
  .acg .acg-block--b .acg-card--tall {
    grid-column: 1;
    grid-row: 1 / span 2;
  }
  .acg .acg-block--b-mirror .acg-card--tall {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
}

/* ---------- Cartão ---------- */

.acg .acg-card {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--acg-radius);
  background: var(--acg-card-bg);
  color: #fff;
  text-decoration: none;
  isolation: isolate;
  -webkit-transition: none;
  transition: none;
}

.acg .acg-card:hover,
.acg .acg-card:focus {
  color: #fff;
  text-decoration: none;
}

.acg .acg-media {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: var(--acg-radius);
  background: var(--acg-card-bg);
  aspect-ratio: 16 / 9;
}

.acg .acg-card--tall .acg-media { aspect-ratio: 4 / 5; }

@media (min-width: 600px) {
  .acg .acg-card--tall .acg-media {
    aspect-ratio: auto;
    height: 100%;
    min-height: 100%;
  }
}

.acg .acg-media picture {
  display: block;
  width: 100%;
  height: 100%;
}

.acg .acg-media img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center center;
  -webkit-transition: -webkit-transform .55s var(--acg-ease);
  transition: transform .55s var(--acg-ease);
  will-change: transform;
}

.acg .acg-card:hover .acg-media img,
.acg .acg-card:focus .acg-media img {
  -webkit-transform: scale(1.045);
  transform: scale(1.045);
}

/* ---------- Legenda sobre a imagem (véu escuro em baixo) ---------- */

.acg .acg-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: block;
  padding: 56px 18px 16px;
  background: -webkit-linear-gradient(to top, rgba(0, 0, 0, .78) 0%, rgba(0, 0, 0, .42) 42%, rgba(0, 0, 0, 0) 100%);
  background: linear-gradient(to top, rgba(0, 0, 0, .78) 0%, rgba(0, 0, 0, .42) 42%, rgba(0, 0, 0, 0) 100%);
  color: #fff;
  pointer-events: none;
}

.acg .acg-meta .acg-title {
  display: inline-block;
  margin: 0;
  padding: 0 0 2px;
  max-width: 100%;
  color: #fff;
  font-family: "Ubuntu", sans-serif;
  font-size: clamp(16px, 1.1vw + 12px, 22px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.2;
  text-transform: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  background-image: linear-gradient(#fff, #fff);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0 2px;
  -webkit-transition: background-size .35s var(--acg-ease);
  transition: background-size .35s var(--acg-ease);
}

.acg .acg-card--tall .acg-meta .acg-title {
  font-size: clamp(20px, 1.4vw + 14px, 28px);
}

.acg .acg-card:hover .acg-title,
.acg .acg-card:focus .acg-title {
  background-size: 36px 2px;
}

.acg .acg-meta .acg-tags {
  display: block;
  margin: 0 0 4px;
  padding: 0;
  color: rgba(255, 255, 255, .82);
  font-family: "Ubuntu", sans-serif;
  font-size: 12.5px;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.3;
  text-transform: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

.acg .acg-arrow { display: none; }

/* ---------- Chamada para acção ---------- */

.acg .acg-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 64px 0 0;
}

.acg .acg-more .acg-more-kicker {
  margin: 0;
  padding: 0;
  color: #555;
  font-family: "Open Sans", sans-serif;
  font-size: 13.5px;
  line-height: 1.4;
}

.acg .acg-more a.acg-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 18px 32px;
  border-radius: 999px;
  background: var(--acg-yellow);
  color: #1a1a1a;
  font-family: "Ubuntu", sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-decoration: none;
  text-transform: none;
  -webkit-transition: background-color .2s ease, -webkit-transform .2s var(--acg-ease);
  transition: background-color .2s ease, transform .2s var(--acg-ease);
}

.acg .acg-more a.acg-cta:hover,
.acg .acg-more a.acg-cta:focus {
  background: var(--acg-yellow-hover);
  color: #1a1a1a;
  text-decoration: none;
  -webkit-transform: translateY(-2px);
  transform: translateY(-2px);
}

.acg a:focus-visible { outline: 2px solid #b18d00; outline-offset: 3px; }

/* ---------- Revelar ao scroll (só quando o JS corre; sem JS tudo fica visível) ---------- */

.acg.acg-js .acg-card {
  opacity: 0;
  -webkit-transform: translateY(18px);
  transform: translateY(18px);
  -webkit-transition: opacity .6s var(--acg-ease), -webkit-transform .6s var(--acg-ease);
  transition: opacity .6s var(--acg-ease), transform .6s var(--acg-ease);
  -webkit-transition-delay: calc(var(--acg-d, 0) * 70ms);
  transition-delay: calc(var(--acg-d, 0) * 70ms);
}

.acg.acg-js .acg-card.is-in {
  opacity: 1;
  -webkit-transform: none;
  transform: none;
}

/* ---------- Telemóvel (até 599 px, como no ynottony): 1 coluna, cartões 4:5 ---------- */

@media (max-width: 599px) {
  .acg {
    --acg-gutter: 8.8px; /* .55rem */
    --acg-radius: 16px;  /* 1rem */
    padding: 16px var(--acg-shell-gutter) clamp(32px, 5vw, 80px);
  }

  .acg .acg-grid,
  .acg .acg-block {
    gap: var(--acg-gutter);
  }

  .acg .acg-media,
  .acg .acg-card--tall .acg-media {
    aspect-ratio: 4 / 5;
    height: auto;
    min-height: 0;
  }

  .acg .acg-meta {
    padding: 56px 16px 16px;
    background: -webkit-linear-gradient(to top, rgba(23, 23, 23, .72) 0%, rgba(23, 23, 23, 0) 48%);
    background: linear-gradient(to top, rgba(23, 23, 23, .72) 0%, rgba(23, 23, 23, 0) 48%);
  }

  .acg .acg-meta .acg-title,
  .acg .acg-card--tall .acg-meta .acg-title {
    display: block;
    max-width: calc(100% - 44px);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.1;
    text-transform: uppercase;
    background-image: none;
    padding-bottom: 0;
  }

  .acg .acg-meta .acg-tags {
    margin: 0 0 6px;
    font-size: 10.5px;
    font-style: normal;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .78);
  }

  .acg .acg-arrow {
    display: block;
    position: absolute;
    right: 16px;
    bottom: 16px;
    z-index: 3;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 50%;
    color: #fff;
    font-family: "Ubuntu", sans-serif;
    font-size: 15px;
    line-height: 30px;
    text-align: center;
    pointer-events: none;
  }

  .acg .acg-more { margin-top: 40px; }
}

/* ---------- Movimento reduzido ---------- */

@media (prefers-reduced-motion: reduce) {
  .acg .acg-media img,
  .acg .acg-meta .acg-title,
  .acg .acg-more a.acg-cta,
  .acg.acg-js .acg-card {
    -webkit-transition: none !important;
    transition: none !important;
  }
  .acg.acg-js .acg-card {
    opacity: 1 !important;
    -webkit-transform: none !important;
    transform: none !important;
  }
  .acg .acg-card:hover .acg-media img,
  .acg .acg-card:focus .acg-media img,
  .acg .acg-more a.acg-cta:hover { -webkit-transform: none; transform: none; }
}
