/* APENF — Pages intérieures (P4) */

body.apenf-page {
  font-family: var(--ap-font);
  color: var(--ap-ink);
  background: var(--ap-white);
}

.apenf-page .preloder {
  display: none !important;
}

/* Bandau page */
.ap-pagehead {
  background: var(--ap-green-deep);
  color: var(--ap-white);
  padding: clamp(2.5rem, 6vw, 4rem) 0;
  border-bottom: 4px solid var(--ap-gold);
}

.ap-pagehead__inner {
  width: var(--ap-container);
  margin-inline: auto;
}

.ap-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  font-size: var(--ap-fs-xs);
  color: rgba(255, 255, 255, 0.75);
}

.ap-breadcrumb a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
}

.ap-breadcrumb a:hover,
.ap-breadcrumb a:focus {
  color: var(--ap-white);
  text-decoration: underline;
}

.ap-pagehead h1 {
  margin: 0;
  max-width: 22ch;
  font-size: var(--ap-fs-xl);
  color: var(--ap-white);
  text-wrap: balance;
}

.ap-pagehead__meta {
  margin: 0.75rem 0 0;
  font-size: var(--ap-fs-sm);
  color: rgba(255, 255, 255, 0.8);
}

/* Layout article */
.ap-layout {
  width: var(--ap-container);
  margin: var(--ap-space-5) auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--ap-space-4);
}

@media (min-width: 992px) {
  .ap-layout {
    grid-template-columns: minmax(0, 1fr) 17.5rem;
    gap: var(--ap-space-5);
    align-items: start;
  }
}

.ap-content {
  min-width: 0;
}

.ap-content .readable-content,
.ap-content .spip-texte {
  font-size: var(--ap-fs-base);
}

.ap-content .readable-content img,
.ap-content .spip-texte img {
  max-width: 100%;
  height: auto;
}

.ap-related {
  margin-top: var(--ap-space-5);
  padding-top: var(--ap-space-3);
  border-top: 1px solid var(--ap-line);
}

.ap-related h2 {
  font-size: var(--ap-fs-md);
  margin: 0 0 var(--ap-space-2);
}

.ap-related ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ap-related li {
  border-bottom: 1px solid var(--ap-line);
}

.ap-related a {
  display: block;
  padding: 0.75rem 0;
  color: var(--ap-ink);
  text-decoration: none;
  font-weight: 600;
}

.ap-related a:hover,
.ap-related a.on {
  color: var(--ap-cta);
}

/* Sidebar */
.ap-sidebar {
  display: grid;
  gap: var(--ap-space-3);
}

.ap-panel {
  border: 1px solid var(--ap-line);
  padding: 1.15rem;
  background: var(--ap-surface);
}

.ap-panel h2 {
  margin: 0 0 0.85rem;
  font-size: var(--ap-fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ap-green);
  border-left: 3px solid var(--ap-red);
  padding-left: 0.55rem;
}

.ap-panel ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ap-panel li + li {
  margin-top: 0.55rem;
}

.ap-panel a {
  color: var(--ap-ink);
  text-decoration: none;
  font-size: var(--ap-fs-sm);
  font-weight: 600;
}

.ap-panel a:hover {
  color: var(--ap-green);
}

.ap-panel .formulaire_spip {
  margin: 0;
}

.ap-panel .formulaire_spip input[type="text"] {
  width: 100%;
  min-height: 2.5rem;
  border: 1px solid var(--ap-line);
  padding: 0.4rem 0.65rem;
}

/* Grille rubrique */
.ap-grid {
  width: var(--ap-container);
  margin: var(--ap-space-5) auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--ap-space-3);
}

@media (min-width: 640px) {
  .ap-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 992px) {
  .ap-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.ap-grid--galerie {
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 768px) {
  .ap-grid--galerie {
    grid-template-columns: repeat(3, 1fr);
  }
}

.ap-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--ap-line);
  background: var(--ap-white);
  overflow: hidden;
  height: 100%;
}

.ap-card__media {
  display: block;
  aspect-ratio: 16 / 10;
  background: var(--ap-surface-2);
  overflow: hidden;
}

.ap-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ap-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.15rem;
  flex: 1;
}

.ap-card__body h2 {
  margin: 0;
  font-size: 1.1rem;
}

.ap-card__body h2 a {
  color: var(--ap-ink);
  text-decoration: none;
}

.ap-card__body h2 a:hover {
  color: var(--ap-cta);
}

.ap-card__body p {
  margin: 0;
  color: var(--ap-muted);
  font-size: var(--ap-fs-sm);
  flex: 1;
}

.ap-empty {
  width: var(--ap-container);
  margin: var(--ap-space-5) auto;
  color: var(--ap-muted);
}

/* Contact */
.ap-contact {
  width: var(--ap-container);
  margin: var(--ap-space-5) auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--ap-space-4);
}

@media (min-width: 900px) {
  .ap-contact {
    grid-template-columns: 0.9fr 1.1fr;
    align-items: start;
  }
}

.ap-contact__infos {
  background: var(--ap-surface);
  border: 1px solid var(--ap-line);
  padding: var(--ap-space-4);
}

.ap-contact__infos h2 {
  margin: 0 0 1rem;
  font-size: var(--ap-fs-md);
}

.ap-contact__infos dl {
  margin: 0;
}

.ap-contact__infos dt {
  font-size: var(--ap-fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ap-muted);
  margin-top: 1rem;
}

.ap-contact__infos dd {
  margin: 0.25rem 0 0;
}

.ap-contact__infos a {
  color: var(--ap-brand);
  font-weight: 600;
  text-decoration: none;
}

.ap-contact__form {
  border: 1px solid var(--ap-line);
  padding: var(--ap-space-4);
}

.ap-contact__form .formulaire_spip .editer-groupe {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ap-contact__form .editer {
  margin-bottom: 1rem;
}

.ap-contact__form label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: var(--ap-fs-sm);
}

.ap-contact__form input[type="text"],
.ap-contact__form input[type="email"],
.ap-contact__form input[type="tel"],
.ap-contact__form textarea {
  width: 100%;
  border: 1px solid var(--ap-line);
  border-radius: var(--ap-radius);
  padding: 0.65rem 0.75rem;
  font-family: var(--ap-font);
  font-size: var(--ap-fs-sm);
}

.ap-contact__form textarea {
  min-height: 9rem;
  resize: vertical;
}

.ap-contact__form .boutons {
  margin-top: 0.5rem;
}

.ap-contact__form .submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.65rem 1.35rem;
  border: 0;
  background: var(--ap-cta);
  color: var(--ap-white);
  font-family: var(--ap-font);
  font-weight: 600;
  cursor: pointer;
}

.ap-contact__form .submit:hover {
  background: var(--ap-cta-hover);
}

.ap-contact__form .reponse_formulaire_ok {
  background: #e8f6ec;
  border: 1px solid #b7e0c2;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}

.ap-contact__form .reponse_formulaire_erreur,
.ap-contact__form .erreur_message {
  color: #a11;
}

.ap-legal {
  margin-top: 0.75rem;
  font-size: var(--ap-fs-xs);
  color: var(--ap-muted);
}

/* Galerie images — grille type album */
.ap-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  margin-top: var(--ap-space-3);
}

@media (min-width: 640px) {
  .ap-gallery {
    grid-template-columns: repeat(3, 1fr);
  }
}

.ap-gallery--album {
  gap: 0.75rem;
  margin-top: 0;
}

@media (min-width: 900px) {
  .ap-gallery--album {
    grid-template-columns: repeat(3, 1fr);
  }
}

.ap-gallery__item {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--ap-surface-2);
  border-radius: var(--ap-radius, 6px);
  position: relative;
}

.ap-gallery__item img,
.ap-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 280ms ease;
}

.ap-gallery__item:hover img,
.ap-gallery__item:focus img {
  transform: scale(1.04);
}

.ap-article-logo {
  width: 100%;
  height: auto;
  margin-bottom: 1.5rem;
  border-radius: var(--ap-radius, 6px);
}

/* Intro galerie : masquer les images déjà reprises en grille */
.ap-galerie-intro .spip_document,
.ap-galerie-intro .spip_documents,
.apenf-galerie .ap-galerie-intro img {
  display: none !important;
}

.ap-galerie-intro:empty {
  display: none;
}

@media (max-width: 767px) {
  .ap-pagehead h1 {
    max-width: none;
  }

  .apenf-page .header-top {
    display: none !important;
  }
}
