/**
 * Layout 3 colonnes — EphemerideDuJour.com
 * Sidebar gauche / Contenu central / Sidebar droite
 */

/* =========================================================
   RESET & BASE
   ========================================================= */

body {
  background-color: var(--color-bg-page);
  color: var(--color-text-main);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}
a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

/* =========================================================
   LAYOUT PRINCIPAL 3 COLONNES
   ========================================================= */

.edj-layout-wrapper {
  display: grid;
  grid-template-columns: var(--sidebar-left-width) 1fr var(--sidebar-right-width);
  grid-template-areas: "sidebar-left main sidebar-right";
  gap: var(--gap-layout);
  width: 100%;
  padding: 16px 24px;
  box-sizing: border-box;
  align-items: start;
}

/* Surcharge du layout Proteus sur les pages éphéméride */
.single-ephemeride .content,
.category-ephemerides .content {
  background: transparent;
  padding: 0;
}

/* =========================================================
   SIDEBAR GAUCHE — Navigation temporelle
   ========================================================= */

.edj-sidebar-left {
  grid-area: sidebar-left;
  position: sticky;
  top: 20px;
}

.edj-sidebar-left-inner {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.edj-sidebar-left .widget-title,
.edj-sidebar-section-title {
  background: var(--color-primary);
  color: #fff;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 8px 14px;
  margin: 0;
}

/* =========================================================
   CONTENU PRINCIPAL
   ========================================================= */

.edj-main-content {
  grid-area: main;
  min-width: 0; /* évite overflow sur grid */
}

/* Article card */
.edj-article-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  margin-bottom: var(--gap-layout);
  box-shadow: var(--shadow-sm);
}

/* H1 article */
.edj-main-content h1.entry-title,
.post-title h1 {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-text-main);
  line-height: 1.3;
  margin-bottom: 16px;
}

/* =========================================================
   SIDEBAR DROITE
   ========================================================= */

.edj-sidebar-right {
  grid-area: sidebar-right;
  position: sticky;
  top: 20px;
}

.edj-sidebar-right-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.edj-sidebar-widget {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.edj-sidebar-widget .widget-title {
  background: var(--color-bg-sidebar);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 14px;
  margin: 0;
}

.edj-sidebar-widget-body {
  padding: 12px 14px;
}

/* Zone publicitaire */
.edj-ad-zone {
  background: var(--color-bg-card);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  text-align: center;
}

.edj-ad-zone ins.adsbygoogle {
  display: block;
}

/* =========================================================
   BREADCRUMB
   ========================================================= */

.edj-breadcrumb {
  width: 100%;
  padding: 8px 24px 0;
  box-sizing: border-box;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.edj-breadcrumb a {
  color: var(--color-text-secondary);
}
.edj-breadcrumb a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.rank-math-breadcrumb {
  font-size: var(--text-sm);
}

/* =========================================================
   RESPONSIVE — Tablet (< 1024px)
   ========================================================= */

@media (max-width: 1023px) {
  .edj-layout-wrapper {
    grid-template-columns: var(--sidebar-left-width) 1fr;
    grid-template-areas:
      "sidebar-left main"
      "sidebar-right sidebar-right";
    --sidebar-left-width: 200px;
  }

  .edj-sidebar-right {
    position: static;
  }

  .edj-sidebar-right-inner {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .edj-sidebar-widget {
    flex: 1 1 280px;
  }
}

/* =========================================================
   RESPONSIVE — Mobile (< 768px)
   ========================================================= */

@media (max-width: 767px) {
  .edj-layout-wrapper {
    grid-template-columns: 1fr;
    grid-template-areas:
      "main"
      "sidebar-right";
    padding: 10px;
    gap: 12px;
  }

  /* Sidebar gauche masquée sur mobile — remplacée par drawer */
  .edj-sidebar-left {
    display: none;
  }

  .edj-sidebar-left.is-open {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    z-index: 9999;
    overflow-y: auto;
    background: var(--color-bg-card);
    box-shadow: 4px 0 20px rgba(0,0,0,0.2);
    padding: 20px 0;
  }

  .edj-sidebar-right {
    position: static;
  }

  .edj-sidebar-right-inner {
    flex-direction: column;
  }

  /* Overlay drawer */
  .edj-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
  }
  .edj-drawer-overlay.is-open {
    display: block;
  }

  /* Bouton ouvrir/fermer navigation mobile */
  .edj-nav-toggle {
    display: flex;
  }

  .edj-article-card {
    padding: 16px;
  }
}

/* Bouton nav mobile — caché sur desktop */
.edj-nav-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
}

.edj-nav-toggle:hover {
  background: var(--color-primary-dark);
}

/* Bouton fermer drawer */
.edj-drawer-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--color-text-secondary);
  line-height: 1;
}
