/* =========================================================
   i-profs.fr — GS Graphisme
   Feuille de style unique et consolidée
   Palette réelle extraite de gs-graphisme.css / i-profs.css :
   vert #3CB371 (accents/CTA), vert foncé #298612 (titres),
   bleu #3B82F6 / orange #F36D01 / vert-lime #9ACD32 (cartes),
   texte #333333, fond blanc #FFFFFF
   ========================================================= */

:root {
  /* Couleurs réelles du site i-profs.fr */
  --color-green: #3CB371;      /* accents, CTA, liens en valeur */
  --color-green-dark: #298612; /* titre "À voir également" */
  --color-card-blue: #3B82F6;  /* en-tête carte Maths GS */
  --color-card-orange: #F36D01;/* en-tête carte Coloriages */
  --color-card-lime: #9ACD32;  /* en-tête carte Cahier d'écriture */
  --color-ink: #000000;
  --color-text: #333333;
  --color-border: #DDDDDD;
  --color-panel: #F5F7F3;
  --color-white: #FFFFFF;

  --font-display: Arial, system-ui, sans-serif;
  --font-body: Arial, system-ui, sans-serif;
  --font-lead: "Open Sans", Arial, sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 12px;

  --shadow-soft: 3px 1px 17px #D3D3D3;
  --shadow-card: 3px 1px 17px #D3D3D3;

  --wrap-width: 1240px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-ink);
  background: var(--color-white);
  line-height: 1.6;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3 { font-family: var(--font-display); margin: 0 0 .5em; }
p { margin: 0 0 1em; }

.wrap {
  max-width: var(--wrap-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* Respect des préférences de mouvement réduit */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Focus visible (accessibilité) ---------- */
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--color-green);
  outline-offset: 2px;
  border-radius: 4px;
}

/* =========================================================
   HEADER
   ========================================================= */
#site-header {
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-row {
  display: flex;
  align-items: center;
  gap: 24px;
  padding-top: 12px;
  padding-bottom: 12px;
  flex-wrap: wrap;
}
.header-logo { flex: 0 0 auto; display: flex; align-items: center; }
.header-logo img { width: auto; height: 90px; max-height: 100%; }
.header-shop { flex: 1 1 auto; min-width: 120px; }
.header-social { display: flex; gap: 10px; }
.header-social img { width: 32px; height: 32px; border-radius: 50%; }

.menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 50px;
  height: 45px;
  background: #F6F6F6;
  border: 1px solid #C5C5C5;
  border-radius: 0;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
}
.menu-toggle:hover {
  background: #EDEDED;
  border-color: #CCCCCC;
}
.menu-toggle .line {
  display: block;
  width: 32px;
  height: 6px;
  background: #454545;
  border-radius: 0;
  margin: 3px auto;
  transition: all 300ms linear;
}
.menu-toggle:hover .line { background: #2B2B2B; }
.menu-toggle .menu-label {
  display: none;
}

/* =========================================================
   NAV — niveaux scolaires
   ========================================================= */
.level-nav {
  background: var(--color-panel);
}
.level-nav-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 10px;
  padding-bottom: 10px;
}
.level-nav-row a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--color-white);
  transition: transform .15s ease, box-shadow .15s ease;
}
.level-nav-row a:hover,
.level-nav-row a.is-active {
  transform: translateY(-3px);
  box-shadow: var(--shadow-soft);
}

/* =========================================================
   TITRE DE PAGE
   ========================================================= */
.page-title {
  text-align: center;
  padding: 48px 0 24px;
}
.page-title h1 {
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.25;
}
.page-title h1 .accent { color: var(--color-green); }
.page-title h2 {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 24px;
  color: var(--color-text);
}

/* =========================================================
   SECTION FICHES : produit / accordéon / diaporama
   ========================================================= */
.fiches-section { padding: 24px 0 56px; }
.fiches-grid {
  display: grid;
  grid-template-columns: 260px 1fr 300px;
  gap: 28px;
  align-items: start;
}
.fiches-col-product,
.fiches-col-preview {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-soft);
}
.fiches-col-preview { text-align: center; }

.btn-download {
  display: inline-block;
  margin-top: 16px;
  background: var(--color-green);
  color: var(--color-white);
  font-weight: 700;
  padding: 12px 22px;
  border-radius: 999px;
  transition: background .15s ease, transform .15s ease;
}
.btn-download:hover { background: var(--color-green); transform: translateY(-2px); }

.preview-slideshow li + li { margin-top: 12px; }
.preview-slideshow img {
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

/* ---------- Accordéon des périodes ---------- */
.accordion {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.accordion-item {
  border-bottom: 1px solid var(--color-border);
}
.accordion-item:last-child { border-bottom: none; }

.accordion-title {
  cursor: pointer;
  list-style: none;
  padding: 16px 22px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--color-ink);
  background: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.accordion-title::-webkit-details-marker { display: none; }
.accordion-title::after {
  content: '+';
  font-size: 20px;
  color: var(--color-green);
  transition: transform .2s ease;
}
.accordion-item[open] > .accordion-title::after { transform: rotate(45deg); }
.accordion-item[open] > .accordion-title { background: var(--color-panel); }

.accordion-body {
  padding: 18px 22px 22px;
}
.free-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 10px;
}
.fiche-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px dashed var(--color-border);
}
.fiche-list li:first-child { border-top: none; }
.fiche-list img { margin-top: 3px; flex-shrink: 0; }
.fiche-list a {
  color: var(--color-ink);
  transition: color .15s ease;
}
.fiche-list a:hover { color: var(--color-green); text-decoration: underline; }

/* =========================================================
   BANDEAU CONSEILS
   ========================================================= */
.conseils-banner { padding: 0 0 40px; }
.conseils-banner img { margin: 0 auto; border-radius: var(--radius-md); }

/* =========================================================
   POURQUOI (why-section)
   ========================================================= */
.why-section { padding: 20px 0 56px; }
.why-section h2 {
  text-align: center;
  font-size: 30px;
  color: var(--color-green-dark);
  font-weight: 700;
  margin-bottom: 32px;
}
.why-row {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  background: var(--color-white);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-soft);
}
.why-icon {
  width: 40px;
  height: 34px;
  flex: 0 0 40px;
  object-fit: contain;
  margin-top: 2px;
}
.why-row p { margin: 0; color: var(--color-text); }
.why-row .lead {
  color: var(--color-green);
  font-weight: 700;
  font-family: var(--font-lead);
}

/* =========================================================
   A VOIR EGALEMENT — cartes
   ========================================================= */
.related-section { padding: 20px 0 56px; }
.related-section h2 {
  text-align: center;
  font-size: 30px;
  color: var(--color-green-dark);
  font-weight: 700;
  margin-bottom: 32px;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
}
.card {
  background: var(--color-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .2s ease;
}
.card:hover { transform: translateY(-6px); }
.card-header {
  background: var(--color-card-blue);
  color: var(--color-white);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  text-align: center;
  padding: 12px;
  letter-spacing: .5px;
}
.card-grid .card:nth-child(2) .card-header { background: var(--color-card-orange); }
.card-grid .card:nth-child(3) .card-header { background: var(--color-card-lime); }
.card-image { width: 100%; object-fit: cover; }
.card-image-book { width: 80%; margin: 0 auto; display: block; }
.card-text { padding: 16px 18px 0; color: var(--color-text); font-size: 15px; flex: 1; }
.card hr { border: none; border-top: 1px solid var(--color-border); margin: 16px 18px 0; }
.card-strip { margin: 12px 18px 0; }
.card-link {
  display: block;
  text-align: center;
  margin: 16px 18px 18px;
  padding: 10px;
  background: var(--color-green);
  color: var(--color-white);
  font-weight: 700;
  border-radius: 999px;
}
.card-link:hover { background: var(--color-ink); }
.card-product {
  text-align: center;
}
.card-product .card-text {
  padding-bottom: 24px;
}

/* =========================================================
   JEUX INTERACTIFS
   ========================================================= */
.games-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding-bottom: 56px;
}
.games-section img { border-radius: var(--radius-md); width: 100%; height: auto; display: block; }
.games-section a { display: block; width: 90%; }

/* =========================================================
   FOOTER
   ========================================================= */
#site-footer {
  background: var(--color-ink);
  color: var(--color-white);
  padding: 22px 0;
}
#site-footer a { color: var(--color-panel); }
#site-footer a:hover { text-decoration: underline; }
#site-footer p { margin: 0; font-size: 13px; text-align: center; }

/* =========================================================
   OVERLAY MENU
   ========================================================= */
.overlay-menu {
  position: fixed;
  inset: 0;
  background: rgba(43, 43, 43, 0.97);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease;
  z-index: 100;
}
.overlay-menu.is-open {
  opacity: 1;
  visibility: visible;
}
.overlay-close {
  position: absolute;
  top: 24px;
  right: 32px;
  background: none;
  border: none;
  color: var(--color-white);
  font-size: 32px;
  cursor: pointer;
}
.drilldown-menu {
  text-align: center;
}
.drilldown-menu > li { margin-bottom: 18px; }
.drilldown-menu > li > a {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
}
.drilldown-menu > li > a:hover { color: var(--color-panel); }
.drilldown-menu .fa { margin-right: 10px; color: var(--color-green); }
.drilldown-menu ul {
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease;
}
.drilldown-menu ul.is-open { max-height: 300px; margin-top: 10px; }
.drilldown-menu ul li { font-size: 16px; padding: 4px 0; opacity: .85; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 960px) {
  .fiches-grid {
    grid-template-columns: 1fr;
  }
  .card-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .header-row { justify-content: center; }
  .header-logo img { height: 60px; }
  .header-shop { order: 3; flex-basis: 100%; text-align: center; }
  .why-row,
  .why-row:nth-child(even) {
    flex-direction: column;
    text-align: center;
  }
  .card-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   GLIGHTBOX — thème (pas de loupe, flèches conservées)
   ========================================================= */
.gscrollbar-fixer { margin-right: 0 !important; }
.glightbox-clean .gclose,
.glightbox-clean .gnext,
.glightbox-clean .gprev {
  background: rgba(26, 26, 26, 0.75);
  border-radius: 50%;
}
.glightbox-clean .gclose svg,
.glightbox-clean .gnext svg,
.glightbox-clean .gprev svg {
  fill: var(--color-white);
}
.gbtn.gzoom { display: none !important; }

@media (max-width: 640px) {
  .gslide-image img {
    max-width: 65%;
    max-height: 55vh;
    width: auto;
    margin: 0 auto;
  }
}
.glightbox-container .goverlay {
  background: rgba(20, 20, 20, 0.55) !important;
}
/* Corrige le débordement de la grille/accordéon : autorise les enfants
   flex/grid à rétrécir sous la largeur de leur contenu (comportement
   par défaut de CSS qui empêche sinon tout retour à la ligne) */
.fiches-grid > * {
  min-width: 0;
}
.fiche-list li {
  min-width: 0;
}
.fiche-list a {
  min-width: 0;
  flex: 1;
}

/* Contient le widget Ecwid (qui vit dans un Shadow DOM non stylable) :
   au lieu d'essayer de le rétrécir, on absorbe son débordement
   à l'intérieur de sa propre case, sans pousser toute la page */
.fiches-col-product {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}
