/* ==========================================================================
   ItsAnime — Upcoming Anime
   Fluid, full-width, device-agnostic dark UI.
   Everything is namespaced under .ia-page-wrapper so it can never leak into
   the theme, and the wrapper itself never sets a max-width: it simply fills
   whatever space the theme's content column (next to your sidebar) gives it.
   ========================================================================== */

.ia-page-wrapper {
  /* --- design tokens --- */
  --ia-bg: #0d0d11;
  --ia-surface: #16161d;
  --ia-surface-2: #1e1e28;
  --ia-line: #2a2a36;
  --ia-text: #eceaf3;
  --ia-muted: #9d9aad;
  --ia-accent: #ff2d6f;
  --ia-accent-2: #7b5bff;
  --ia-accent-soft: rgba(255, 45, 111, 0.14);
  --ia-radius: 14px;
  --ia-radius-sm: 10px;
  --ia-gap: clamp(12px, 1.4vw, 22px);
  --ia-pad: clamp(14px, 2.2vw, 32px);
  --ia-card: clamp(140px, 16vw, 200px);
  --ia-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --ia-ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: var(--ia-pad);
  box-sizing: border-box;
  overflow-x: clip;
  background: var(--ia-bg);
  color: var(--ia-text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  font-size: clamp(14px, 0.55vw + 12px, 16px);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  container-type: inline-size;
}

.ia-page-wrapper *,
.ia-page-wrapper *::before,
.ia-page-wrapper *::after {
  box-sizing: border-box;
}

.ia-page-wrapper img {
  max-width: 100%;
  display: block;
}

.ia-page-wrapper :focus-visible {
  outline: 2px solid var(--ia-accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.ia-sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========== HEADINGS ========== */
.ia-page-wrapper .ia-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: clamp(30px, 4vw, 56px) 0 clamp(14px, 1.6vw, 22px);
  font-size: clamp(18px, 1.5vw + 10px, 28px);
  font-weight: 800;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: #fff;
  border: 0;
  padding: 0;
}

.ia-page-wrapper .ia-heading::before {
  content: "";
  flex: 0 0 auto;
  width: 5px;
  height: 1.1em;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--ia-accent), var(--ia-accent-2));
}

.ia-page-wrapper .ia-sub-heading {
  margin: clamp(22px, 3vw, 36px) 0 12px;
  padding-bottom: 10px;
  font-size: clamp(15px, 0.9vw + 10px, 20px);
  font-weight: 700;
  color: var(--ia-accent);
  border-bottom: 1px solid var(--ia-line);
}

.ia-page-wrapper .ia-month-heading {
  margin: 18px 0 10px;
  font-size: clamp(13px, 0.5vw + 10px, 16px);
  font-weight: 600;
  color: var(--ia-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ========== HERO SLIDESHOW ========== */
.ia-slideshow-container {
  position: relative;
  width: 100%;
  aspect-ratio: 21 / 8;
  min-height: 220px;
  max-height: 560px;
  overflow: hidden;
  border-radius: var(--ia-radius);
  box-shadow: var(--ia-shadow);
  background: var(--ia-surface);
}

@media (max-width: 700px) {
  .ia-slideshow-container {
    aspect-ratio: 16 / 11;
  }
}

.ia-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  visibility: hidden;
  transform: scale(1.04);
  transition: opacity 0.7s var(--ia-ease), transform 6s linear, visibility 0.7s;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  border: 0;
  padding: 0;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
}

.ia-slide.active {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  z-index: 2;
}

.ia-slide-overlay {
  width: 100%;
  padding: clamp(16px, 3vw, 44px);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.6) 45%, transparent 100%);
}

.ia-badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--ia-accent);
  color: #fff;
  font-size: clamp(10px, 0.4vw + 8px, 12px);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ia-slide-title {
  margin: 0 0 8px;
  font-size: clamp(18px, 2.4vw + 8px, 42px);
  font-weight: 800;
  line-height: 1.15;
  color: #fff;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.7);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ia-slide-date {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  font-size: clamp(12px, 0.5vw + 9px, 15px);
  color: #e6e3f0;
}

.ia-slide-countdown {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ia-slide-desc {
  margin: 10px 0 0;
  max-width: 68ch;
  color: #cfcbdd;
  font-size: clamp(12px, 0.45vw + 9px, 15px);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 600px) {
  .ia-slide-desc {
    display: none;
  }
}

.ia-slide-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  display: grid;
  place-items: center;
  width: clamp(34px, 3vw, 46px);
  height: clamp(34px, 3vw, 46px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.ia-slide-nav:hover {
  background: var(--ia-accent);
  transform: translateY(-50%) scale(1.08);
}

.ia-slide-nav.prev { left: 12px; }
.ia-slide-nav.next { right: 12px; }

.ia-slide-dots {
  position: absolute;
  z-index: 5;
  bottom: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 7px;
}

.ia-slide-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: width 0.25s, background 0.25s;
}

.ia-slide-dot.active {
  width: 24px;
  background: var(--ia-accent);
}

/* ========== SECTION HEADER WITH ACTION ========== */
.ia-section-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.ia-section-head {
  margin: clamp(30px, 4vw, 56px) 0 clamp(14px, 1.6vw, 22px);
}

.ia-section-head .ia-heading {
  margin: 0;
}

.ia-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border: 1px solid var(--ia-line);
  border-radius: 999px;
  background: var(--ia-surface-2);
  color: var(--ia-text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.ia-btn:hover {
  background: var(--ia-accent);
  border-color: var(--ia-accent);
  color: #fff;
  transform: translateY(-1px);
}

/* ========== HORIZONTAL RAILS ========== */
.ia-horizontal-scroll-wrapper {
  position: relative;
  margin-bottom: clamp(18px, 2vw, 28px);
}

.ia-horizontal-scroll {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--ia-card);
  gap: var(--ia-gap);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 4px;
  padding: 4px 2px 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--ia-line) transparent;
  cursor: grab;
}

.ia-horizontal-scroll::-webkit-scrollbar { height: 6px; }
.ia-horizontal-scroll::-webkit-scrollbar-track { background: transparent; }
.ia-horizontal-scroll::-webkit-scrollbar-thumb {
  background: var(--ia-line);
  border-radius: 999px;
}
.ia-horizontal-scroll::-webkit-scrollbar-thumb:hover { background: var(--ia-accent); }

.ia-scroll-btn {
  position: absolute;
  top: calc(50% - 14px);
  transform: translateY(-50%);
  z-index: 4;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--ia-line);
  border-radius: 50%;
  background: rgba(13, 13, 17, 0.88);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
}

.ia-horizontal-scroll-wrapper:hover .ia-scroll-btn,
.ia-scroll-btn:focus-visible { opacity: 1; }
.ia-scroll-btn:hover { background: var(--ia-accent); }
.ia-scroll-btn.left { left: -6px; }
.ia-scroll-btn.right { right: -6px; }

@media (hover: none) {
  .ia-scroll-btn { display: none; }
}

/* ========== POSTER CARD ========== */
.ia-anime-card,
.ia-2026-card {
  position: relative;
  display: flex;
  flex-direction: column;
  scroll-snap-align: start;
  border: 1px solid var(--ia-line);
  border-radius: var(--ia-radius-sm);
  background: var(--ia-surface);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  color: inherit;
  font: inherit;
  width: 100%;
  transition: transform 0.25s var(--ia-ease), border-color 0.25s, box-shadow 0.25s;
}

.ia-anime-card:hover,
.ia-2026-card:hover {
  transform: translateY(-5px);
  border-color: var(--ia-accent);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.55);
}

.ia-card-img-wrap,
.ia-2026-card-img {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: var(--ia-surface-2);
}

.ia-card-img-wrap img,
.ia-2026-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ia-ease);
}

.ia-anime-card:hover .ia-card-img-wrap img,
.ia-2026-card:hover .ia-2026-card-img img {
  transform: scale(1.06);
}

.ia-card-countdown {
  position: absolute;
  left: 8px;
  bottom: 8px;
  right: 8px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ia-card-content,
.ia-2026-card-content {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 11px 12px;
}

.ia-card-title,
.ia-2026-card-title {
  margin: 0;
  font-size: clamp(12px, 0.35vw + 10px, 14px);
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ia-card-date,
.ia-2026-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
  font-size: 11.5px;
  color: var(--ia-muted);
}

.ia-2026-score { color: #ffc53d; font-weight: 700; }

/* Synopsis stays in the DOM and is readable — crawlers index it, humans get
   a two-line teaser and the full text in the modal. */
.ia-card-synopsis {
  margin: 2px 0 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--ia-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ia-2026-type-badge,
.ia-2026-season-badge {
  position: absolute;
  top: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #fff;
}

.ia-2026-type-badge { left: 8px; background: var(--ia-accent); }
.ia-2026-season-badge { right: 8px; background: rgba(0, 0, 0, 0.7); }

/* ========== FULL-LINEUP GRID (modal) ========== */
.ia-2026-full-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(130px, 15vw, 180px), 1fr));
  gap: var(--ia-gap);
  padding: 4px 0 24px;
}

/* ========== MODALS (shared) ========== */
.ia-2026-modal,
.ia-details-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 3vw, 40px);
}

.ia-2026-modal.active,
.ia-details-modal.active { display: flex; }

.ia-2026-overlay,
.ia-details-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 8, 0.82);
  backdrop-filter: blur(6px);
  animation: ia-fade 0.25s ease;
}

.ia-2026-modal-content,
.ia-details-content {
  position: relative;
  z-index: 1;
  width: min(100%, 1100px);
  max-height: min(92vh, 900px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--ia-line);
  border-radius: var(--ia-radius);
  background: var(--ia-surface);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.7);
  animation: ia-pop 0.3s var(--ia-ease);
  padding: clamp(16px, 2.4vw, 28px);
  color: var(--ia-text);
}

.ia-details-content { width: min(100%, 880px); }

@keyframes ia-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ia-pop {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.ia-2026-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.ia-2026-title {
  margin: 0;
  font-size: clamp(16px, 1.2vw + 10px, 24px);
  font-weight: 800;
  color: #fff;
}

.ia-2026-close,
.ia-details-close {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--ia-line);
  border-radius: 50%;
  background: var(--ia-surface-2);
  color: var(--ia-text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.ia-2026-close:hover,
.ia-details-close:hover { background: var(--ia-accent); color: #fff; }

.ia-details-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}

.ia-2026-search {
  width: 100%;
  margin-bottom: 14px;
  padding: 12px 18px;
  border: 1px solid var(--ia-line);
  border-radius: 999px;
  background: var(--ia-surface-2);
  color: var(--ia-text);
  font-size: 15px;
}

.ia-2026-search::placeholder { color: var(--ia-muted); }

.ia-2026-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.ia-2026-filter-btn {
  padding: 7px 16px;
  border: 1px solid var(--ia-line);
  border-radius: 999px;
  background: var(--ia-surface-2);
  color: var(--ia-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.ia-2026-filter-btn:hover { color: #fff; border-color: var(--ia-accent); }
.ia-2026-filter-btn.active {
  background: var(--ia-accent);
  border-color: var(--ia-accent);
  color: #fff;
}

/* ========== DETAILS MODAL ========== */
.ia-details-body {
  display: grid;
  grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
  gap: clamp(14px, 2vw, 26px);
}

@media (max-width: 640px) {
  .ia-details-body { grid-template-columns: 1fr; }
  .ia-details-img { max-width: 190px; margin: 0 auto; }
}

.ia-details-img img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--ia-radius-sm);
  border: 1px solid var(--ia-line);
}

.ia-details-info { min-width: 0; }

.ia-details-info h2 {
  margin: 0 0 10px;
  padding-right: 44px;
  font-size: clamp(18px, 1.4vw + 10px, 28px);
  font-weight: 800;
  line-height: 1.2;
  color: #fff;
}

.ia-details-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.ia-details-meta span {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--ia-surface-2);
  border: 1px solid var(--ia-line);
  font-size: 12.5px;
  color: var(--ia-muted);
}

.ia-details-meta span.ia-pill-accent {
  background: var(--ia-accent-soft);
  border-color: rgba(255, 45, 111, 0.35);
  color: #ff90b4;
  font-weight: 700;
}

/* countdown inside the popup, right above the synopsis */
.ia-countdown {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--ia-line);
  border-radius: var(--ia-radius-sm);
  background: linear-gradient(135deg, rgba(255, 45, 111, 0.12), rgba(123, 91, 255, 0.12));
}

.ia-countdown-label {
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ia-muted);
}

.ia-countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.ia-countdown-unit {
  padding: 10px 4px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  text-align: center;
}

.ia-countdown-value {
  font-size: clamp(18px, 1.6vw + 8px, 28px);
  font-weight: 800;
  line-height: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.ia-countdown-unit span {
  display: block;
  margin-top: 5px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ia-muted);
}

.ia-countdown-note {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.ia-details-synopsis {
  max-height: 40vh;
  overflow-y: auto;
  padding-right: 6px;
}

.ia-details-synopsis h3 {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ia-muted);
}

.ia-details-synopsis p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.7;
  color: #d6d3e2;
}

.ia-details-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.ia-details-genres span {
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--ia-surface-2);
  font-size: 11.5px;
  color: var(--ia-muted);
}

.ia-details-trailer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ia-accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.ia-details-trailer:hover { background: var(--ia-accent-2); color: #fff; }

/* ========== EMPTY STATE ========== */
.ia-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--ia-muted);
}

/* ========== CONTAINER QUERIES: adapt to the space left by the sidebar ====== */
@container (max-width: 760px) {
  .ia-page-wrapper { --ia-card: clamp(128px, 30cqw, 160px); }
}

@container (max-width: 420px) {
  .ia-page-wrapper { --ia-card: 44cqw; }
}

@media (max-width: 480px) {
  .ia-countdown-grid { gap: 6px; }
  .ia-2026-filters { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .ia-2026-filter-btn { white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  .ia-page-wrapper *,
  .ia-details-modal *,
  .ia-2026-modal * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
