/* 
====== Développé par TEAM LogicPulse ======
| YouTube :                               |
| Discord : https://discord.gg/efVfp5A89k |
| Instagram : @team_LogicPulse            |
===========================================
*/

/* ===================
Reset léger + tokens
=================== */
:root {
  --bg: #0f1117; /* fond global sombre cohérent avec la page login */
  --surface: #151823; /* surface cartes */
  --line: rgba(255, 255, 255, 0.08);
  --text: #e7ecf3;
  --muted: #9aa3b2;
  --brand: #8e7cf8; /* gradient brand 1 */
  --brand-2: #6c63ff; /* gradient brand 2 */
  --accent: #9b5cff; /* accent secondaire */
  --radius: 16px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}

body {
  font: 16px/1.6 "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial,
    sans-serif;
  background: radial-gradient(
      1100px 700px at 15% 15%,
      #3b3650 0%,
      transparent 60%
    ),
    radial-gradient(1100px 700px at 85% 85%, #2a2537 0%, transparent 60%),
    linear-gradient(180deg, #2a2435, #201c27 60%, #1a1620);
  color: var(--text);
  min-height: 100dvh;
}
img {
  max-width: 100%;
  display: block;
}
a {
  color: inherit;
  text-decoration: none;
}
ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.sr-only {
  position: absolute;
  left: -10000px;
}

/* Layout global */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 14px;
  margin-bottom: 8px;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}
.brand {
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.2px;
  background: linear-gradient(90deg, #fff, #cfe8ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.nav {
  display: flex;
  gap: 14px;
}
.nav-link {
  color: var(--muted);
  padding: 8px 12px;
  overflow: hidden;
  transition: color 0.3s ease, background 0.3s ease;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  isolation: isolate;
  background-clip: padding-box;
  height: 40px;
  min-width: 100px;
  justify-content: center;
}
.nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}
.nav-link.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

/* HERO / À LA UNE */
.featured {
  margin-top: 8px;
}
.featured-card {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow);
}
.featured-title-link {
  text-decoration: none;
  color: inherit; /* garde la couleur du h1 */
}

.featured-title-link:hover,
.featured-title-link:focus {
  text-decoration: underline; /* feedback au survol */
}
.featured-media {
  position: relative;
  display: block;
}
.featured-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 16/10;
}
.media-overlay {
  position: absolute;
  inset: 0;
}
.media-chip {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 2;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #0c1220;
  background: linear-gradient(135deg, var(--accent), var(--brand));
}
.featured-body {
  padding: 26px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Base */
.chip {
  display: inline-block;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(142, 124, 248, 0.12);
  color: #cfd4ff;
  border: 1px solid rgba(142, 124, 248, 0.35);
  width: fit-content;
}

/* Couleurs par catégorie */
.chip[data-category="vie-du-lycée"] {
  background: rgba(56, 214, 123, 0.14); /* vert vif */
  color: #c6ffe1;
  border-color: rgba(56, 214, 123, 0.4);
}

.chip[data-category="science-et-progrès"] {
  background: rgba(255, 99, 132, 0.14); /* rose/rouge */
  color: #ffd6de;
  border-color: rgba(255, 99, 132, 0.4);
}

.chip[data-category="culture-et-arts"] {
  background: rgba(54, 162, 235, 0.14); /* bleu */
  color: #d2ebff;
  border-color: rgba(54, 162, 235, 0.4);
}

.chip[data-category="sport"] {
  background: rgba(255, 206, 86, 0.14); /* jaune/or */
  color: #fff2c9;
  border-color: rgba(255, 206, 86, 0.4);
}

.chip[data-category="un-oeil-sur-le-monde"] {
  background: rgba(155, 89, 182, 0.14); /* violet */
  color: #edd6f6;
  border-color: rgba(155, 89, 182, 0.4);
}

.chip[data-category="autres"] {
  background: rgba(99, 110, 114, 0.14); /* gris neutre */
  color: #e5e7ea;
  border-color: rgba(99, 110, 114, 0.4);
}

.chip[data-category="orientation"] {
  background: rgba(26, 188, 156, 0.14); /* turquoise */
  color: #caf7ef;
  border-color: rgba(26, 188, 156, 0.4);
}

.featured-title {
  font-size: clamp(26px, 2.6vw, 40px);
  line-height: 1.15;
  margin: 0;
}
.featured-title a:hover {
  text-decoration: underline;
}
.featured-excerpt {
  color: var(--muted);
  margin: 0;
}

.featured-meta {
  color: var(--muted);
  font-size: 14px;
  margin-top: auto;
}

.featured-h1 {
  font-size: 40px;
  line-height: 1.15;
  margin: 0;
}
.featured-h3 {
  font-size: 20px;
  line-height: 1.15;
  margin: 0;
}
.featured-content {
  font-size: 13px; /* ou 14px, selon ton échelle */
  color: var(--muted); /* facultatif : teinte plus douce */
}

/* ===== Clamp + fade ===== */
.featured-content {
  --clamp-lines: 8;
  --line-height: 1.6;
  --fade-lines: 4; /* ← nombre de lignes fondues */
  --fade-height: calc(var(--fade-lines) * 1em * var(--line-height));
}

/* État clamped */
.featured-content.is-clamped {
  max-height: calc(var(--clamp-lines) * 1em * var(--line-height));
  overflow: hidden;

  /* le noir (1) reste visible jusqu'à 100% - fade, puis passe à 0 */
  -webkit-mask-image: linear-gradient(
    to bottom,
    rgb(0 0 0 / 1) calc(100% - var(--fade-height)),
    rgb(0 0 0 / 0) 100%
  );
  mask-image: linear-gradient(
    to bottom,
    rgb(0 0 0 / 1) calc(100% - var(--fade-height)),
    rgb(0 0 0 / 0) 100%
  );
}

/* État déplié */
.featured-content.is-expanded {
  max-height: 9999px;
  -webkit-mask-image: none;
  mask-image: none;
}

/* Bouton “Lire la suite” */
.read-more {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border: 0;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;

  /* reprends ton style glassy */
  color: #eae8ff;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.04)
  );
  backdrop-filter: blur(6px) saturate(110%);
  box-shadow: 0 8px 18px rgba(108, 99, 255, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Optionnel: cache le bouton si le contenu n’est pas assez long */
.read-more[hidden] {
  display: none;
}

/* Motion-safe */
@media (prefers-reduced-motion: reduce) {
  .featured-content.is-clamped {
    transition: none;
  }
}

/* Section head */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 26px;
  margin-bottom: 12px;
}
.section-head h1,
.section-head h2 {
  margin: 0;
  line-height: 1.2;
  font-size: 25px;
}
.see-all {
  color: #fff;
  display: inline-flex;
  align-items: center;
  background: transparent;
  padding: 10px 20px;
  border: 2px solid #9b5cff;
  border-radius: 999px;
  font-weight: 700;
  font-size: 16px;
  font-family: sans-serif;
  cursor: pointer;
  transition: border-color 0.3s ease, background-color 0.3s ease,
    color 0.3s ease;
}
.see-all {
  transform: translateY(-8px);
}
.see-all:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: #9f71e9;
}

/* Grid des derniers articles */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  overflow: hidden;
  transition: transform 0.12s ease, box-shadow 0.12s ease,
    border-color 0.12s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: rgba(255, 255, 255, 0.18);
}

.card-media img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.card-body {
  padding: 14px;
  display: grid;
  gap: 6px;
}

.card-title {
  font-size: 23px;
  margin: 0;
  line-height: 1.25;
}

.card-title a:hover {
  text-decoration: underline;
}

.card-excerpt {
  font-size: 15px;
  color: var(--muted);
  margin: 0;
}

.card-meta {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

@media (max-width: 720px) {
  .articles-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 520px) {
  .articles-grid {
    grid-template-columns: 1fr;
  }
}

/* Footer */
.footer {
  color: var(--muted);
  font-size: 14px;
  padding-block: 28px;
  border-top: 1px solid var(--line);
  margin-top: 28px;
  display: grid;
  gap: 6px;
}
.footer .by {
  opacity: 0.9;
}

/* Focus visible (accessibilité) */
:focus-visible {
  outline: 3px solid rgba(142, 124, 248, 0.6);
  outline-offset: 2px;
  border-radius: 8px;
}

/* Motion safe */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* Responsive */
@media (max-width: 980px) {
  .container {
    padding: 16px;
  }
  .featured-card {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 720px) {
  .articles-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 520px) {
  .nav {
    display: none;
  }
  .articles-grid {
    grid-template-columns: 1fr;
  }
}

/* ====== Contour animé des boutons du header ====== */
:root {
  --violet: #9b5cff;
  --ring-w: 1.5px; /* épaisseur du trait en px (utilisée ci-dessous) */
  --ring-gap: 3px;
}

/* Le SVG occupe 100% du lien et suit sa forme */
.nav-ring {
  position: absolute;
  inset: calc(var(--ring-w) / -2);
  width: calc(100% + var(--ring-w));
  height: calc(100% + var(--ring-w));
  pointer-events: none;
  border-radius: inherit;
  display: block;
}

/* Le rectangle suit la taille du SVG et ses coins sont arrondis.
   pathLength=100 => dash en pourcentage du périmètre */
.nav-ring__stroke {
  fill: none;
  stroke: var(--violet);
  stroke-width: var(--ring-w);
  stroke-linecap: round;
  stroke-linejoin: round;
  shape-rendering: geometricPrecision;

  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  opacity: 0;
  transition: opacity 120ms ease;
}

/* Survol d’un bouton non actif : on dessine le contour du haut et on fait tout le tour */
@keyframes nav-stroke-draw {
  from {
    stroke-dashoffset: 100;
  }
  to {
    stroke-dashoffset: 0;
  }
}
.nav-link:not(.is-active):hover .nav-ring__stroke {
  opacity: 1;
  animation: nav-stroke-draw 600ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.nav-link.is-active .nav-ring__stroke {
  opacity: 1;
  stroke-dashoffset: 0;
  animation: none;
}

/* ===== 
Derniers articles
===== */

/* grille UL propre */
.latest .articles-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  padding: 0;
  list-style: none;
}

/* <li> neutre */
.latest .articles-grid > li {
  margin: 0;
}

/* Carte */
.latest .card {
  display: grid;
  grid-template-rows: auto 1fr;
  background: radial-gradient(
      100% 140% at 20% 0%,
      rgba(255, 255, 255, 0.02) 0%,
      rgba(255, 255, 255, 0) 60%
    ),
    var(#201c27);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, border-color 0.25s ease,
    box-shadow 0.25s ease, background 0.25s ease;
  position: relative;
}

/* Hover lift + glow + border */
.latest .card:hover {
  transform: translateY(-3px);
  border-color: rgba(142, 124, 248, 0.28);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.52);
}

/* Media 16/9 + zoom on hover */
.latest .card-media {
  display: block;
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0e0f14;
}
.latest .card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
  transition: transform 0.35s ease, opacity 0.35s ease;
  opacity: 0.96;
}
.latest .card:hover .card-media img {
  transform: scale(1.06);
  opacity: 1;
}

/* Corps */
.latest .card-body {
  padding: 14px 14px 16px;
  display: grid;
  gap: 8px;
}

/* Meta + chip (reprend les couleurs par data-category) */
.latest .card-meta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.latest .card-meta .chip {
  display: inline-block;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  /* ne pas fixer background/couleurs ici pour laisser les règles .chip[data-category="..."] s'appliquer */
}

/* Titre + lien */
.latest .card-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
  font-weight: 700;
}
.latest .card-title a {
  color: var(--text);
  text-decoration: none;
}
.latest .card-title a:hover {
  text-decoration: underline;
}

/* Extrait clamped sur 2 lignes */
.latest .card-excerpt {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Responsive cohérent */
@media (max-width: 980px) {
  .latest .articles-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 520px) {
  .latest .articles-grid {
    grid-template-columns: 1fr;
  }
}
