/* ==========   VARIABLES LIGHT / DARK   ========== */
:root {
  /* light */
  --clr-bg: #f7f8fc;
  --clr-bg-card: #ffffff;
  --clr-text: #222831;
  --clr-text-sub: #69707d;
  --clr-primary: #745cf7;
  --clr-accent: #ff6ba5;
  --opacity-card: 0.85;
}
body.dark {
  --clr-bg: #15171a;
  --clr-bg-card: #1e2024;
  --clr-text: #eceff4;
  --clr-text-sub: #a6adba;
  --clr-primary: #8f9aff;
  --clr-accent: #ff7fb3;
  --opacity-card: 1;
}

/* ==========   RESET + BASE   ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  font-family: "Urbanist", system-ui, sans-serif;
  background: var(--clr-bg);
  color: var(--clr-text);
  overflow-x: hidden;
  line-height: 1.55;
  transition: background 0.35s ease, color 0.35s ease;
}
img {
  display: block;
  width: 100%;
  height: auto;
}

/* ==========   HEADER   ========== */
header {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.55);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 500;
  transition: background 0.35s ease, border 0.35s ease;
}
body.dark header {
  background: rgba(21, 23, 26, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.header-container {
  max-width: 1400px;
  padding: 1rem 5%;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  width: 15%;
}

/* ==========   SOCIAL ICONS + THEME TOGGLE   ========== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 15%;
  justify-content: flex-end;
}
.social-icons {
  display: flex;
  gap: 1rem;
}
.social-icons a {
  color: var(--clr-text);
  font-size: 1.25rem;
  transition: color 0.3s ease;
}
.social-icons a:hover {
  color: var(--clr-primary);
}
.theme-toggle {
  background: none;
  border: 2px solid var(--clr-primary);
  color: var(--clr-primary);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.3s ease, color 0.3s ease;
  min-width: 38px;
}
.theme-toggle:hover {
  background: var(--clr-primary);
  color: #fff;
}

/* ==========   NAVIGATION   ========== */
.logo img {
  display: block;
  height: 1.7rem;
  width: auto;
}
nav ul {
  display: flex;
  gap: 2rem;
  list-style: none;
}
nav a {
  text-decoration: none;
  color: var(--clr-text);
  font-weight: 600;
  position: relative;
  transition: color 0.3s ease;
}
nav a:hover {
  color: var(--clr-primary);
}
nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 0;
  height: 2px;
  background: var(--clr-primary);
  transition: width 0.3s ease;
}
nav a:hover::after {
  width: 100%;
}

/* ==========   MAIN   ========== */
main {
  max-width: 1400px;
  margin: auto;
  padding: 3rem 5%;
}
section {
  margin-bottom: 4rem;
}
.section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 2rem;
  display: inline-block;
  position: relative;
  color: var(--clr-text);
}
.section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -8px;
  width: 80px;
  height: 4px;
  background: var(--clr-primary);
}

/* ==========   LAST CHAPTERS   ========== */
.latest-chapters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 2rem;
}
.chapter-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  background: var(--clr-bg-card);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.07);
  transition: transform 0.4s cubic-bezier(0.2, 0.6, 0.2, 1), box-shadow 0.4s;
}
.chapter-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}
.chapter-cover {
  height: 100%;
  overflow: hidden;
}
.chapter-cover img {
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.chapter-card:hover .chapter-cover img {
  transform: scale(1.07);
}
/* overlay info */
.chapter-info {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  padding: 1rem;
  color: #fff;
  transition: background 0.35s ease;
}
.chapter-time {
  position: absolute;
  bottom: 1.1rem;
  right: 1rem;
  font-size: 0.85rem;
  color: #ddd;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.chapter-time i {
  font-size: 1rem;
}
.manga-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.chapter-number {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--clr-accent);
}
.chapter-title {
  font-size: 0.85rem;
  color: #ddd;
  margin-bottom: 0.2rem;
}

/* NEW badge */
.new-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--clr-accent);
  color: #fff;
  padding: 0.4rem 0.9rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 999px;
  animation: pulse 1.6s infinite;
}
.multi-chapter {
  position: absolute;
  top: 12px;
  left: 12px;
  background: #00000082;
  border: 0.15rem solid var(--clr-accent);
  color: #fff;
  padding: 0.1rem 0.6rem;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 999px;
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

/* ==========   SERIES   ========== */
.series-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 2rem;
}
.series-card {
  display: flex;
  align-items: stretch;
  background: var(--clr-bg-card);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.07);
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.2, 0.6, 0.2, 1), box-shadow 0.35s;
}
.series-card:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.1);
}
.series-cover {
  flex: 0 0 140px;
  position: relative;
  overflow: hidden;
}
.series-cover img {
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}
.series-card:hover .series-cover img {
  transform: scale(1.07);
}
.series-info {
  flex: 1;
  padding: 1.2rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.series-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  color: var(--clr-text);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.series-redirect {
  z-index: 1;
  width: 100%;
  margin-left: -100%;
}
.meta {
  z-index: 2;
  font-size: 0.9rem;
  color: var(--clr-text-sub);
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.25rem;
}
.tag {
  background: rgba(116, 92, 247, 0.15);
  color: var(--clr-primary);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ==========   ANIMATIONS ENTREES   ========== */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.section-title,
.chapter-card,
.series-card {
  opacity: 0;
  animation: fade-up 0.6s ease forwards;
}

/* Responsive tweaks */
@media (max-width: 768px) {
  nav ul {
    gap: 1rem;
  }
  .section-title {
    font-size: 1.7rem;
  }
  .chapter-cover {
    height: 260px;
  }
  .series-grid {
    grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
  }

  .chapter-cover img {
    height: 190%;
  }
}

/* ========== TRUNCATE TEXT ========== */
.manga-title,
.chapter-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chapter-number-stylish {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 0.2rem 0.6rem;
  background: #373737;
  color: #fff;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.3s ease;
}
.chapter-number-stylish:hover {
  background: #242424;
}

/* ========== CAROUSEL LATEST CHAPTERS ========== */
.carousel-container {
  position: relative;
  overflow: hidden;
  margin-bottom: 2rem;
}
.carousel-track {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
}
.carousel-track::-webkit-scrollbar {
  display: none;
}
.carousel-prev,
.carousel-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.3s ease;
  z-index: 10;
}
.carousel-prev:hover,
.carousel-next:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: translateY(-50%) scale(1.1);
}
.carousel-prev {
  left: 0.75rem;
}
.carousel-next {
  right: 0.75rem;
}
.carousel-track .chapter-card {
  flex: 0 0 calc((100% - 3rem) / 4);
  scroll-snap-align: start;
}
.carousel-track {
  cursor: grab;
}
.carousel-track.active {
  cursor: grabbing;
}
@media (max-width: 1024px) {
  .carousel-track .chapter-card {
    flex: 0 0 calc((100% - 1rem) / 2);
  }
}
@media (max-width: 768px) {
  .carousel-track .chapter-card {
    flex: 0 0 100%;
  }
}

@media (max-width: 768px) {
  nav ul {
    display: none;
  }
}

/* ==========   PAGE SÉRIE   ========== */
.serie-hero {
  margin: 3rem 0 4rem;
  display: flex;
  gap: 2.5rem;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .6s ease, transform .6s ease;
}
.serie-hero .cover {
  flex: 0 0 260px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(0,0,0,.1);
}
.serie-hero img { height: 100%; object-fit: cover; }

.serie-hero .infos { flex: 1; display: flex; flex-direction: column; gap: 1rem; }
.serie-hero h1 { font-size: 2.2rem; font-weight: 800; line-height: 1.2; }
.serie-hero .synopsis { font-size: .95rem; color: var(--clr-text-sub); }

.serie-hero .meta { list-style: none; font-size: .9rem; color: var(--clr-text-sub); }
.serie-hero .meta li { margin-bottom: .25rem; }

.chapters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(260px,1fr));
  gap: 1.2rem;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .6s ease .15s, transform .6s ease .15s;
}

/* mini-carte chapitre */
.chapter-card-mini {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  padding: 1rem 1.2rem;
  background: var(--clr-bg-card);
  border-radius: 12px;
  text-decoration: none;
  color: var(--clr-text);
  box-shadow: 0 10px 24px rgba(0,0,0,.07);
  transition: transform .35s cubic-bezier(.2,.6,.2,1), box-shadow .35s;
}
.chapter-card-mini:hover {
  transform: translateY(-6px) scale(1.03);
  box-shadow: 0 18px 36px rgba(0,0,0,.1);
}
.chapter-card-mini .num   { font-weight: 600; }
.chapter-card-mini .title { font-size: .9rem; color: var(--clr-text-sub); }
.chapter-card-mini .time  { font-size: .8rem; color: var(--clr-text-sub); display: flex; align-items: center; gap: .25rem; }

@media (max-width: 768px) {
  .serie-hero { flex-direction: column; align-items: center; text-align: center; }
  .serie-hero .cover { width: 60%; max-width: 300px; }
}

/* === Mise en page deux colonnes === */
.serie-container {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 2.5rem;
  padding: 3rem 5%;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .6s ease, transform .6s ease;
}
.serie-aside {
  top: 1.5rem;
  align-self: start;
}
.serie-aside .cover {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(0,0,0,.07);
  margin-bottom: 1.5rem;
}
.serie-aside img {
  display: block;
  width: 100%;
  height: auto;
}
.meta-list {
  background: var(--clr-bg-card);
  padding: 0.3rem 0;
  margin: 0 0 1.5rem;
  display: grid;
  box-shadow: 0 8px 20px rgba(0,0,0,.05);
  border-radius: 8px;
}
.meta-list span {
  padding: .4rem .8rem;
  font-size: 0.9rem;
  color: var(--clr-text-sub);
  font-weight: 500;
}

.meta-list span strong {
  color: var(--clr-primary);
}

.chapters-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.tag {
  background: rgba(116,92,247,.15);
  color: var(--clr-primary);
  padding: .2rem .6rem;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 600;
}

/* === Contenu principal === */
.serie-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}


.serie-header h1 {
  font-size: 2.4rem;
  margin-bottom: .6rem;
}
.serie-header .synopsis {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--clr-text-sub);
  white-space: normal;
  overflow-wrap: break-word;
  max-height: 180px;
  overflow-y: auto;
  padding-right: .5rem;
  padding-top: 1rem;
}

.serie-button {
  display: flex;
  padding-top: 0.1rem;
}

.serie-button > a{
  margin-right: 0.5rem;
}

/* === Chapitres horizontaux === */
.chapters-section h2 {
  margin-bottom: 1rem;
  font-size: 1.6rem;
}

.chapters-section h2::after {
  content: "";
  display: block;
  width: 60px;
  height: 4px;
  background: var(--clr-primary);
  margin-top: .5rem;
}

.chapter-card-horizontal {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: .8rem;
  padding: .8rem 1.2rem;
  background: var(--clr-bg-card);
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0,0,0,.07);
  cursor: pointer;
  transition: transform .3s ease, box-shadow .3s ease;
}
.chapter-card-horizontal:hover {
  transform: translateY(-4px);
  color: var(--clr-accent);
  box-shadow: 0 16px 32px rgba(0,0,0,.1);
}
.c-num    { font-weight: 600; white-space: nowrap; }
.c-num:hover { color: var(--clr-accent); }
.c-title  { font-size: .9rem; color: var(--clr-text); overflow: hidden; text-overflow: ellipsis; max-width: 380px; }
.c-group  { font-size: .85rem; color: var(--clr-text-sub); white-space: nowrap; text-align: right; }
.c-date   { font-size: .8rem; color: var(--clr-text-sub); white-space: nowrap; padding-left:1rem;}
.chapter-card-horizontal .c-num {
  transition: color 0.3s ease-in-out;
}


.chapter-card-horizontal .c-title {
  transition: color 0.3s ease-in-out;
}

.chapter-card-horizontal:hover .c-title {
  color: var(--clr-accent);
}
/* Réactivité mobile */
@media (max-width: 768px) {
  .serie-container {
    display: flex;
    flex-direction: column;
    padding: 2rem 3%;
  }
  .serie-aside {
    position: relative;
    top: auto;
    margin-bottom: 2rem;
    text-align: center;
  }
  .chapters-row {
    gap: .8rem;
  }
  .chapter-card-horizontal {
    grid-template-columns: auto 1fr;
    grid-template-rows: repeat(2, auto);
    gap: .4rem;
  }
  .c-group, .c-date { display: none; }
}

.serie-header .section-title {
  font-size: 2.4rem;
  margin-bottom: .8rem;
  display: inline-block;
  position: relative;
  color: var(--clr-text);
}

.serie-header .section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 60px;
  height: 4px;
  background: var(--clr-primary);
}

/* ==== Bouton de tri ==== */
.chapters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

/* === Bouton de tri “joli” === */
.toggle-order {
  background: var(--clr-primary);
  border: none;
  color: #fff;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.2s ease, transform 0.2s ease;
}
.toggle-order i {
  font-size: 1rem;
}
.toggle-order:hover {
  background: var(--clr-accent);
  transform: scale(1.05);
} 

/* ==== Volume dans la fiche chapitre ==== */
.chapter-card-vertical {
  display: grid;
  /* Colonne fixe pour chaque span : 
     • c-num (Chap.) → 70px 
     • c-vol (Tome) → 40px 
     • c-title (Titre) → prend le reste 
     • c-group (Groupe) → 120px 
     • c-date (Date)  → 100px */
  grid-template-columns: 
    60px   /* c-num  */ 
    70px
    1fr    /* c-title*/ 
    148px  /* c-group*/ 
    100px; /* c-date */
  align-items: center;
  gap: .6rem;
  padding: .8rem 1.2rem;
  background: var(--clr-bg-card);
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0,0,0,.07);
  cursor: pointer;
  transition: transform .3s ease, box-shadow .3s ease;
  text-decoration: none;
  color: inherit;
}

.chapter-card-vertical .c-num,
.chapter-card-vertical .c-vol,
.chapter-card-vertical .c-title {
  transition: color 0.3s ease-in-out;
}

/* Au survol de la carte verticale, passe ces éléments en couleur accent */
.chapter-card-vertical:hover .c-num,
.chapter-card-vertical:hover .c-vol,
.chapter-card-vertical:hover .c-title {
  color: var(--clr-accent);
}

.chapter-card-vertical:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px rgba(0,0,0,.1);
}
.chapter-card-vertical .c-vol {
  font-size: .85rem;
  font-weight: 600;
  color: var(--clr-text-sub);
  white-space: nowrap;
  text-align: center;
}

/* Responsive : masque le volume si trop étroit */
@media (max-width: 768px) {
  .chapter-card-vertical {
    grid-template-columns: auto 1fr;
    grid-template-rows: repeat(3, auto);
  }
  .c-vol { display: none; }
}

.button {
  background: var(--clr-primary);
  width: fit-content;
  border: none;
  color: #fff;
  padding: 0.5rem 0.90rem;
  border-radius: 0.7rem;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s;
}
.button:hover {
  background: var(--clr-accent);
}
.button-secondary {
  background: var(--clr-text-sub);
}
.button-secondary:hover {
  background: hsl(from var(--clr-text-sub) h s calc(l - 20));
}
.button-disabled {
  background: hsl(from var(--clr-text-sub) h s calc(l - 10 ));
  color: var(--clr-text-sub);
}
.button-disabled:hover {
  background: hsl(from var(--clr-text-sub) h s calc(l - 10 ));    
  cursor: not-allowed;
}
body.dark .button-disabled {
  background: hsl(from var(--clr-text-sub) h s calc(l - 50  ));
  color: hsl(from var(--clr-text-sub) h s calc(l - 30 ));
}
body.dark .button-disabled:hover {
  background: hsl(from var(--clr-text-sub) h s calc(l - 50));
}