/**
 * Miruro-style anime cards + home 6-col sizing
 */

.mac {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
  width: 100%;
  color: inherit;
  transition: transform 0.22s ease;
}
.mac:hover,
.mac:focus-within {
  transform: translateY(-0.15rem);
}

.mac__poster {
  position: relative;
  width: 100%;
  border-radius: 0.75rem;
  overflow: hidden;
  /* Sabit oran → lazy yüklemede CLS yok (2/3’ten ~%10 daha alçak) */
  aspect-ratio: 2 / 2.7;
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  box-shadow: var(--theme-shadow-soft);
  isolation: isolate;
  contain: layout;
  container-type: inline-size;
  transition: box-shadow 0.22s ease, border-color 0.22s ease;
}
.mac:hover .mac__poster,
.mac:focus-within .mac__poster {
  border-color: color-mix(in srgb, var(--theme-accent) 42%, var(--theme-border));
  box-shadow:
    var(--theme-shadow),
    0 0 0 1px color-mix(in srgb, var(--theme-accent) 35%, transparent);
}

.mac__hit {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 1;
  text-decoration: none;
  color: inherit;
}
.mac__hit img,
.mac__ph {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s var(--aml-ease, ease), filter 0.25s ease;
}
.mac__ph {
  background: linear-gradient(145deg, var(--theme-surface), var(--theme-bg));
}

.mac__hit::after {
  content: "";
  position: absolute;
  inset: 0;
  background: transparent;
  transition: background 0.25s ease;
  pointer-events: none;
}

.mac__play {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(0.88);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  color: var(--theme-accent-ink);
}
.mac__play i {
  display: grid;
  place-items: center;
  width: clamp(1.85rem, 22cqw, 2.45rem);
  height: clamp(1.85rem, 22cqw, 2.45rem);
  border-radius: 999px;
  background: var(--theme-accent);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--theme-accent) 40%, transparent);
  font-size: clamp(0.7rem, 8cqw, 0.88rem);
  margin-left: 0.1rem;
}

.mac:hover .mac__hit img,
.mac:focus-within .mac__hit img {
  transform: scale(1.05);
  filter: brightness(0.92) saturate(1.05);
}
.mac:hover .mac__hit::after,
.mac:focus-within .mac__hit::after {
  background: color-mix(in srgb, #000 38%, transparent);
}
.mac:hover .mac__play,
.mac:focus-within .mac__play {
  opacity: 1;
  transform: scale(1);
}

/* Listeye ekle (+) */
.mac-add {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 4;
  opacity: 0;
  transform: translateY(-0.15rem);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.mac:hover .mac-add,
.mac:focus-within .mac-add,
.mac-add.is-open {
  opacity: 1;
  transform: none;
}
.mac-add__btn {
  appearance: none;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.mac-add__btn:hover,
.mac-add__btn.is-active {
  background: var(--theme-accent);
  border-color: var(--theme-accent);
  color: var(--theme-accent-ink);
}
.mac-add__btn i {
  font-size: 0.95rem;
  line-height: 1;
}
.mac-add__menu {
  min-width: 9rem;
  max-width: min(11rem, calc(100vw - 1rem));
  padding: 0.28rem;
  border-radius: 0.45rem;
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  box-shadow: var(--theme-panel-shadow);
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  color: var(--theme-text);
}
.mac-add__menu--portal {
  position: fixed;
  z-index: 1300;
  right: auto;
  top: auto;
}
.mac-add__opt {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--theme-text);
  text-align: left;
  padding: 0.38rem 0.5rem;
  border-radius: 0.3rem;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
  line-height: 1.2;
}
.mac-add__opt:hover,
.mac-add__opt.is-active {
  background: color-mix(in srgb, var(--theme-accent) 16%, transparent);
  color: var(--theme-text);
}

.mac__body {
  min-width: 0;
  padding: 0 0.1rem;
}
.mac__title-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  text-decoration: none;
  color: var(--theme-text) !important;
  min-width: 0;
  transition: color 0.15s ease;
}
.mac:hover .mac__title-row,
.mac:focus-within .mac__title-row {
  color: var(--theme-accent) !important;
}
.mac__dot {
  flex: 0 0 auto;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--theme-accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--theme-accent) 22%, transparent);
}
.mac__title {
  min-width: 0;
  font-family: var(--aml-font-display);
  font-size: clamp(0.72rem, 0.78vw, 0.8125rem);
  font-weight: var(--aml-fw-semibold);
  line-height: 1.3;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: inherit;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

.mac__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.22rem;
  margin-top: 0.3rem;
}
.mac__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.18rem;
  padding: 0.14rem 0.32rem;
  border-radius: 0.28rem;
  /* Light/dark tema chip token’ları — accent-soft pembe yıkama yok */
  background: var(--theme-chip-bg);
  border: 1px solid var(--theme-chip-bd);
  color: var(--theme-chip-fg);
  font-family: var(--aml-font-body);
  font-size: clamp(0.62rem, 0.7vw, 0.72rem);
  font-weight: var(--aml-fw-medium);
  line-height: 1;
}
.mac__chip i {
  font-size: 0.62rem;
  opacity: 0.95;
  color: inherit;
}
.mac__chip .fa-star {
  color: var(--theme-accent);
}

/*
 * Boyutlandırma — eski auto-fill/--ru-w ezilsin:
 * ana kolon tam genişlik / 6 kart
 */
html body.aml-shell main#main-content .home-layout__main .recent-update-section .anime-grid-modern,
html body.aml-shell main#main-content .home-layout__main #recentUpdateGrid.anime-grid-modern,
html body.aml-shell main#main-content .home-layout__main #top100Grid.anime-grid-modern,
html body.aml-shell .homepage-inner .home-layout__main .recent-update-section .anime-grid-modern,
html body.aml-shell .home-layout__main #recentUpdateGrid,
html body.aml-shell .home-layout__main #top100Grid {
  display: grid !important;
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  gap: 1rem 0.8rem !important;
  justify-content: stretch !important;
  align-items: start !important;
  width: 100% !important;
  max-width: 100% !important;
}

html body.aml-shell .home-layout__main .anime-grid-modern > *,
html body.aml-shell .home-layout__main #recentUpdateGrid > *,
html body.aml-shell .home-layout__main #top100Grid > * {
  flex: none !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
}

.anime-grid-modern .mac,
.anime-grid .mac,
#recentUpdateGrid .mac,
#top100Grid .mac {
  width: 100% !important;
  max-width: 100% !important;
}

.most-viewed-slider-section .mac-rank-wrap .mac,
.most-viewed-slider-section .most-viewed-card-wrap .mac {
  width: 100%;
}

/*
 * Arşiv / detaylı arama / genre filtre — tam genişlik, Miruro ~8 kolon
 * Kart boyutu home 6-kolon ile yakın (aynı mac poster oranı)
 */
html body.aml-shell .filter-results .anime-grid-modern,
html body.aml-shell .filter-results .archive-grid,
html body.aml-shell #archiveGrid.anime-grid-modern,
html body.aml-shell .archive-grid {
  display: grid !important;
  grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
  gap: 1rem 0.8rem !important;
  justify-content: stretch !important;
  align-items: start !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

html body.aml-shell .filter-results .anime-grid-modern > *,
html body.aml-shell .archive-grid > *,
html body.aml-shell #archiveGrid > * {
  flex: none !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
}

@media (max-width: 90rem) {
  html body.aml-shell .filter-results .archive-grid,
  html body.aml-shell #archiveGrid.anime-grid-modern {
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 75rem) {
  html body.aml-shell .filter-results .archive-grid,
  html body.aml-shell #archiveGrid.anime-grid-modern {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 64rem) {
  html body.aml-shell .filter-results .archive-grid,
  html body.aml-shell #archiveGrid.anime-grid-modern {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 48rem) {
  html body.aml-shell .filter-results .archive-grid,
  html body.aml-shell #archiveGrid.anime-grid-modern {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.75rem 0.5rem !important;
  }
}
@media (max-width: 30rem) {
  html body.aml-shell .filter-results .archive-grid,
  html body.aml-shell #archiveGrid.anime-grid-modern {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* ~1440px altı: 6 kolon fazla sıkışıyor */
@media (max-width: 90rem) {
  html body.aml-shell main#main-content .home-layout__main .recent-update-section .anime-grid-modern,
  html body.aml-shell main#main-content .home-layout__main #recentUpdateGrid.anime-grid-modern,
  html body.aml-shell main#main-content .home-layout__main #top100Grid.anime-grid-modern,
  html body.aml-shell .home-layout__main #recentUpdateGrid,
  html body.aml-shell .home-layout__main #top100Grid {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 0.9rem 0.7rem !important;
  }
}
@media (max-width: 75rem) {
  html body.aml-shell main#main-content .home-layout__main .recent-update-section .anime-grid-modern,
  html body.aml-shell main#main-content .home-layout__main #recentUpdateGrid.anime-grid-modern,
  html body.aml-shell main#main-content .home-layout__main #top100Grid.anime-grid-modern,
  html body.aml-shell .home-layout__main #recentUpdateGrid,
  html body.aml-shell .home-layout__main #top100Grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

/* Mobil: klasik grid, 2 kolon — kartlar büyük (2×2 slider hissi) */
@media (max-width: 64rem) {
  html body.aml-shell main#main-content .home-layout__main .recent-update-section .anime-grid-modern,
  html body.aml-shell main#main-content .home-layout__main #recentUpdateGrid.anime-grid-modern,
  html body.aml-shell main#main-content .home-layout__main #top100Grid.anime-grid-modern,
  html body.aml-shell .homepage-inner .home-layout__main .recent-update-section .anime-grid-modern,
  html body.aml-shell .home-layout__main #recentUpdateGrid,
  html body.aml-shell .home-layout__main #top100Grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 1rem 0.75rem !important;
  }

  .recent-update-section .mac,
  #recentUpdateGrid .mac,
  #top100Grid .mac {
    gap: 0.55rem;
  }
  .recent-update-section .mac__poster,
  #recentUpdateGrid .mac__poster,
  #top100Grid .mac__poster {
    border-radius: 0.85rem;
  }
  .recent-update-section .mac__title,
  #recentUpdateGrid .mac__title,
  #top100Grid .mac__title {
    font-size: clamp(0.82rem, 3.4vw, 0.95rem);
    font-weight: 700;
    line-height: 1.3;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .recent-update-section .mac__dot,
  #recentUpdateGrid .mac__dot,
  #top100Grid .mac__dot {
    width: 0.48rem;
    height: 0.48rem;
  }
  .recent-update-section .mac__chips,
  #recentUpdateGrid .mac__chips,
  #top100Grid .mac__chips {
    gap: 0.28rem;
    margin-top: 0.35rem;
  }
  .recent-update-section .mac__chip,
  #recentUpdateGrid .mac__chip,
  #top100Grid .mac__chip {
    font-size: 0.7rem;
    padding: 0.18rem 0.4rem;
  }
  .recent-update-section .mac-add__btn,
  #recentUpdateGrid .mac-add__btn,
  #top100Grid .mac-add__btn {
    width: 1.85rem;
    height: 1.85rem;
  }
  .mac-add {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 48rem) {
  .mac-add {
    opacity: 1;
    transform: none;
  }
}

