/*
Theme Name: Isowafa
Theme URI: https://www.isowafa.com/
Author: Isowafa
Description: Thème bloc sur mesure du cabinet Isowafa (Casablanca) — conseil en normes ISO, management de la qualité et mise en place d'ERP. Mise en page éditoriale à sections numérotées, pensée pour des contenus de procédure.
Version: 1.0
Requires at least: 6.5
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: isowafa
Tags: block-templates, full-site-editing, one-column, custom-colors, editor-style
*/

/* ---------------------------------------------------------------
   1. Repères communs
--------------------------------------------------------------- */
:root {
  --iw-ink: var(--wp--preset--color--contrast, #0E2226);
  --iw-teal: var(--wp--preset--color--primary, #0F7A80);
  --iw-clay: var(--wp--preset--color--accent, #BE5430);
  --iw-line: var(--wp--preset--color--line, #D7E0E1);
  --iw-muted: var(--wp--preset--color--muted, #54676A);
  --iw-surface: var(--wp--preset--color--surface, #F1F5F5);
}

body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

/* Le trait sarcelle sous l'en-tête : signature discrète du site */
.iw-header { border-bottom: 1px solid var(--iw-line); }
.iw-header::after {
  content: "";
  display: block;
  height: 2px;
  background: linear-gradient(90deg, var(--iw-teal) 0 33%, var(--iw-clay) 33% 46%, transparent 46%);
  margin-top: var(--wp--preset--spacing--30);
}

.iw-header .wp-block-navigation a {
  text-decoration: none;
  font-size: 0.94rem;
  color: var(--iw-ink);
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}
.iw-header .wp-block-navigation a:hover { border-bottom-color: var(--iw-teal); color: var(--iw-ink); }

/* ---------------------------------------------------------------
   2. Corps éditorial
--------------------------------------------------------------- */
.entry-content { counter-reset: iw-section; }

.entry-content > h2 {
  counter-increment: iw-section;
  position: relative;
  margin-top: var(--wp--preset--spacing--50);
  margin-bottom: var(--wp--preset--spacing--30);
  padding-top: 1.1rem;
  border-top: 1px solid var(--iw-line);
}

/* Le numéro de section : l'écriture « procédure » propre au cabinet */
.entry-content > h2::before {
  content: counter(iw-section, decimal-leading-zero);
  display: block;
  font-family: var(--wp--preset--font-family--mono, monospace);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--iw-teal);
  margin-bottom: 0.45rem;
}

.entry-content > h3 {
  margin-top: var(--wp--preset--spacing--40);
  margin-bottom: var(--wp--preset--spacing--20);
}

/* Chapô « En bref » : premier paragraphe de l'article */
.entry-content > p:first-of-type {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--iw-ink);
  background: var(--iw-surface);
  border-left: 3px solid var(--iw-clay);
  padding: 1.1rem 1.3rem;
  margin-bottom: var(--wp--preset--spacing--40);
}

.entry-content ul, .entry-content ol { padding-left: 1.15rem; }
.entry-content li { margin-bottom: 0.45rem; }
.entry-content ul { list-style: none; padding-left: 0; }
.entry-content ul > li { position: relative; padding-left: 1.35rem; }
.entry-content ul > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  background: var(--iw-teal);
}
.entry-content ol > li::marker { color: var(--iw-teal); font-weight: 600; }

.entry-content strong { font-weight: 650; }

/* ---------------------------------------------------------------
   3. Tableaux
--------------------------------------------------------------- */
.entry-content table, .wp-block-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.96rem;
  margin: var(--wp--preset--spacing--40) 0;
}
.wp-block-table { overflow-x: auto; }
.entry-content th, .wp-block-table th {
  background: var(--iw-ink);
  color: #fff;
  text-align: left;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.7rem 0.85rem;
  border: none;
}
.entry-content td, .wp-block-table td {
  padding: 0.65rem 0.85rem;
  border: none;
  border-bottom: 1px solid var(--iw-line);
  vertical-align: top;
}
.entry-content tbody tr:nth-child(even) td { background: var(--iw-surface); }

/* ---------------------------------------------------------------
   4. FAQ dépliante
--------------------------------------------------------------- */
.entry-content details {
  border: 1px solid var(--iw-line);
  border-left: 3px solid var(--iw-teal);
  padding: 0.85rem 1.05rem;
  margin-bottom: 0.6rem;
  background: #fff;
}
.entry-content details[open] { background: var(--iw-surface); }
.entry-content summary {
  cursor: pointer;
  font-weight: 620;
  list-style: none;
  position: relative;
  padding-right: 1.6rem;
}
.entry-content summary::-webkit-details-marker { display: none; }
.entry-content summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: -0.1rem;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--iw-teal);
}
.entry-content details[open] summary::after { content: "\2212"; }
.entry-content details > p { margin: 0.6rem 0 0; }

/* ---------------------------------------------------------------
   5. Encarts
--------------------------------------------------------------- */
.iw-note, .entry-content .iw-note {
  background: var(--iw-surface);
  border-left: 3px solid var(--iw-clay);
  padding: 1rem 1.2rem;
  font-size: 0.95rem;
  color: var(--iw-muted);
  margin: var(--wp--preset--spacing--40) 0;
}
.iw-note strong { color: var(--iw-ink); }
.iw-note p:last-child { margin-bottom: 0; }

/* Bloc « repère » utilisé sur les pages de présentation */
.iw-spec {
  border: 1px solid var(--iw-line);
  border-top: 3px solid var(--iw-ink);
  padding: 1.4rem 1.5rem;
  height: 100%;
}
.iw-spec h3 { margin-top: 0; }
.iw-spec p:last-child { margin-bottom: 0; }

/* Étiquette mono en surtitre */
.iw-eyebrow {
  font-family: var(--wp--preset--font-family--mono, monospace);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--iw-teal);
  margin-bottom: 0.6rem;
}

/* ---------------------------------------------------------------
   6. Listes d'articles
--------------------------------------------------------------- */
.iw-card {
  border-top: 1px solid var(--iw-line);
  padding-top: var(--wp--preset--spacing--30);
}
.iw-card .wp-block-post-title { margin: 0 0 0.35rem; font-size: 1.2rem; line-height: 1.3; }
.iw-card .wp-block-post-title a { text-decoration: none; color: var(--iw-ink); }
.iw-card .wp-block-post-title a:hover { color: var(--iw-teal); }
.iw-card .wp-block-post-excerpt { color: var(--iw-muted); font-size: 0.96rem; }
.iw-card .wp-block-post-date { color: var(--iw-muted); }

.wp-block-query-pagination { border-top: 1px solid var(--iw-line); padding-top: var(--wp--preset--spacing--30); }
.wp-block-query-pagination a { text-decoration: none; }
.wp-block-query-pagination .current { font-weight: 700; color: var(--iw-clay); }

/* ---------------------------------------------------------------
   7. Pied de page
--------------------------------------------------------------- */
.iw-footer, .iw-footer p, .iw-footer li { color: #C8D6D8; }
.iw-footer h3 { color: #fff; font-size: 1rem; letter-spacing: 0.01em; }
.iw-footer a { color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.28); }
.iw-footer a:hover { border-bottom-color: var(--iw-clay); color: #fff; }

/* ---------------------------------------------------------------
   8. Divers
--------------------------------------------------------------- */
.wp-block-post-terms a { text-decoration: none; color: var(--iw-teal); }
.entry-content a { text-underline-offset: 0.15em; }
.wp-block-post-featured-image img { display: block; width: 100%; height: auto; }

@media (max-width: 600px) {
  .entry-content > p:first-of-type { font-size: 1.06rem; }
  .iw-header::after { background: var(--iw-teal); }
}

@media print {
  .iw-header, .iw-footer, .wp-block-query-pagination, .wp-block-navigation { display: none !important; }
  .entry-content details { border: none; padding: 0; }
  .entry-content details[open] { background: none; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.75em; color: #555; }
}
