/*
 * Foot.fr blog — article content and core blocks.
 * Loaded on the front (scoped by .entry-content) and in the block editor
 * through add_editor_style() (scoped by .is-root-container), so authors see the final look.
 */

:where(.entry-content, .is-root-container) {
  font-size: 1.0625rem;
  line-height: 1.7;
  color: #1d1d1d;
}

:where(.entry-content, .is-root-container) > * { margin-block: 0 1.25rem; }

/* Headings */
:where(.entry-content, .is-root-container) h2 {
  margin: 2.75rem 0 1rem;
  font-size: 1.5rem;
  line-height: 1.2;
  padding-left: .875rem;
  border-left: 6px solid #1dbbff;
}
:where(.entry-content, .is-root-container) h3 { margin: 2rem 0 .75rem; font-size: 1.25rem; }
:where(.entry-content, .is-root-container) h4 { margin: 1.5rem 0 .5rem; font-size: 1.0625rem; }

/* Text */
:where(.entry-content, .is-root-container) p { text-align: left; }
:where(.entry-content, .is-root-container) p.has-text-align-center { text-align: center; }
:where(.entry-content, .is-root-container) strong { font-weight: 700; }

/* Links: dark text with the cyan foot.fr underline (cyan text alone fails contrast on white) */
:where(.entry-content, .is-root-container) a:not(.wp-block-button__link) {
  color: #1d1d1d;
  text-decoration: underline;
  text-decoration-color: #1dbbff;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  font-weight: 500;
}
:where(.entry-content, .is-root-container) a:not(.wp-block-button__link):hover { background: #e1f4fc; }

/* Lists */
:where(.entry-content, .is-root-container) :is(ul, ol) { padding-left: 1.25rem; }
:where(.entry-content, .is-root-container) li { margin-bottom: .5rem; }
:where(.entry-content, .is-root-container) ul li::marker { color: #1dbbff; }

/* Quote */
:where(.entry-content, .is-root-container) .wp-block-quote,
:where(.entry-content, .is-root-container) blockquote {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  border: 0;
  border-left: 6px solid #1d1d1d;
  background: #fcfcfc;
  font-size: 1.125rem;
  font-weight: 500;
}
:where(.entry-content, .is-root-container) blockquote p:last-child { margin-bottom: 0; }
:where(.entry-content, .is-root-container) blockquote cite { display: block; margin-top: .5rem; font-size: .875rem; font-style: normal; color: #646464; }

/* Images */
:where(.entry-content, .is-root-container) .wp-block-image { margin-block: 2rem; }
:where(.entry-content, .is-root-container) .wp-block-image img { display: block; height: auto; }
:where(.entry-content, .is-root-container) figcaption,
:where(.entry-content, .is-root-container) .wp-element-caption {
  margin-top: .5rem; font-size: .8125rem; color: #646464; text-align: center;
}

/* Separator, table, embeds */
:where(.entry-content, .is-root-container) hr,
:where(.entry-content, .is-root-container) .wp-block-separator { margin: 3rem auto; border: 0; border-top: 1px solid #eaeaea; }
:where(.entry-content, .is-root-container) table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
:where(.entry-content, .is-root-container) :is(th, td) { padding: .625rem .75rem; border: 1px solid #eaeaea; text-align: left; }
:where(.entry-content, .is-root-container) th { background: #1d1d1d; color: #fff; font-weight: 700; }
:where(.entry-content, .is-root-container) .wp-block-embed iframe,
:where(.entry-content, .is-root-container) iframe { max-width: 100%; }

/* Wide / full alignments inside the 760px reading column */
.entry-content .alignwide { margin-inline: max(-220px, calc((760px - min(1200px, 100vw - 2.5rem)) / 2)); }
.entry-content .alignfull { margin-inline: calc(50% - 50vw); max-width: 100vw; width: 100vw; }

/* Buttons (core/button): foot.fr primary button */
:where(.entry-content, .is-root-container) .wp-block-buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
:where(.entry-content, .is-root-container) .wp-block-buttons.aligncenter,
:where(.entry-content, .is-root-container) .wp-block-buttons.is-content-justification-center { justify-content: center; }
:where(.entry-content, .is-root-container) .wp-block-button__link {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: .75rem 1.5rem;
  border: 0; border-radius: 28px;
  background-color: #1dbbff; color: #1d1d1d;
  font: 700 .8125rem/1.1 Inter, system-ui, sans-serif;
  letter-spacing: .04em; text-transform: uppercase; text-decoration: none;
  transition: filter .15s ease;
}
:where(.entry-content, .is-root-container) .wp-block-button__link:hover { filter: brightness(.92); }
:where(.entry-content, .is-root-container) .is-style-outline .wp-block-button__link { background: transparent; border: 2px solid currentColor; }

/* Columns (core/columns) */
:where(.entry-content, .is-root-container) .wp-block-columns {
  display: flex; flex-wrap: nowrap; gap: 1rem;
  margin-block: 1.5rem 2rem;
}
:where(.entry-content, .is-root-container) .wp-block-column { flex: 1 1 0; min-width: 0; }
@media (max-width: 781.98px) {
  .entry-content .wp-block-columns { flex-wrap: wrap; }
  .entry-content .wp-block-column { flex-basis: 100% !important; }
}

/*
 * Product cards built from core blocks (draft "Cadeaux de Noël", id 1882):
 * a column holding an image + buttons is rendered exactly like the cards of
 * the "Produits Foot.fr" block / foot.fr product miniatures: rounded border,
 * white square visual, orange discount flag on the image, grey body, left text,
 * orange price. Colours saved inline by the editor are overridden on purpose.
 */
:where(.entry-content, .is-root-container) .wp-block-column:has(> .wp-block-image):has(> .wp-block-buttons) {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto auto;
  padding: 0 0 .75rem;
  border: 1px solid #eaeaea; border-radius: 8px; overflow: hidden;
  background: #fcfcfc;
  transition: border-color .15s ease;
}
@media (hover: hover) {
  :where(.entry-content, .is-root-container) .wp-block-column:has(> .wp-block-image):has(> .wp-block-buttons):hover { border-color: #1d1d1d; }
  :where(.entry-content, .is-root-container) .wp-block-column:has(> .wp-block-image):has(> .wp-block-buttons):hover > .wp-block-image img { transform: scale(1.05); }
}
:where(.entry-content, .is-root-container) .wp-block-column:has(> .wp-block-image):has(> .wp-block-buttons) > * { margin: 0; padding-inline: .75rem; }

/* Visual: first grid row, the discount flag shares the same cell (bottom-left) */
:where(.entry-content, .is-root-container) .wp-block-column:has(> .wp-block-image):has(> .wp-block-buttons) > .wp-block-image {
  grid-row: 1; grid-column: 1;
  padding: 0; margin-bottom: .75rem;
  background: #fff; border-bottom: 1px solid #eaeaea; overflow: hidden;
}
:where(.entry-content, .is-root-container) .wp-block-column:has(> .wp-block-image):has(> .wp-block-buttons) > .wp-block-image img { width: 100%; aspect-ratio: 1; object-fit: contain; transition: transform .3s ease; }
:where(.entry-content, .is-root-container) .wp-block-column:has(> .wp-block-image):has(> .wp-block-buttons) > p:first-child:has(> span[style*="background"]) {
  grid-row: 1; grid-column: 1; align-self: end; justify-self: start;
  z-index: 1; margin-bottom: .75rem; padding: 0;
}
:where(.entry-content, .is-root-container) .wp-block-column:has(> .wp-block-image):has(> .wp-block-buttons) > p:first-child > span[style*="background"] {
  display: inline-block; padding: .375rem .5rem !important; border-radius: 0 !important;
  background: #ff611d !important; color: #1d1d1d !important;
  font-size: .8125rem; font-weight: 700; line-height: 1;
}
:where(.entry-content, .is-root-container) .wp-block-column:has(> .wp-block-image):has(> .wp-block-buttons) > p:first-child > span[style*="background"] strong { font-weight: 700; }

/* Name, price, link */
:where(.entry-content, .is-root-container) .wp-block-column:has(> .wp-block-image):has(> .wp-block-buttons) > p { text-align: left !important; font-size: .875rem; line-height: 1.35; }
:where(.entry-content, .is-root-container) .wp-block-column:has(> .wp-block-image):has(> .wp-block-buttons) > p:has(> a) { align-self: start; }
:where(.entry-content, .is-root-container) .wp-block-column:has(> .wp-block-image):has(> .wp-block-buttons) > p > a { font-weight: 700; text-decoration: none; color: #1d1d1d; }
:where(.entry-content, .is-root-container) .wp-block-column:has(> .wp-block-image):has(> .wp-block-buttons) a:hover { background: none; }
:where(.entry-content, .is-root-container) .wp-block-column:has(> .wp-block-image):has(> .wp-block-buttons) > p:has(> s), :where(.entry-content, .is-root-container) .wp-block-column:has(> .wp-block-image):has(> .wp-block-buttons) > p:has(> strong):not(:first-child) { margin-top: .5rem; font-size: .875rem; }
:where(.entry-content, .is-root-container) .wp-block-column:has(> .wp-block-image):has(> .wp-block-buttons) > p .has-inline-color { color: #ff611d !important; }
:where(.entry-content, .is-root-container) .wp-block-column:has(> .wp-block-image):has(> .wp-block-buttons) > p s { margin-left: .375rem; font-size: .75rem; color: #646464; }
:where(.entry-content, .is-root-container) .wp-block-column:has(> .wp-block-image):has(> .wp-block-buttons) > .wp-block-buttons { margin: .5rem 0 0 !important; justify-content: flex-start !important; }
/* Cards without discount keep an empty "&nbsp;" paragraph where the flag would be */
:where(.entry-content, .is-root-container) .wp-block-column:has(> .wp-block-image):has(> .wp-block-buttons) > p:first-child:not(:has(> span[style*="background"], > a, > strong)) { display: none; }

/* Whole card clickable: the image link is stretched over the column */
.entry-content .wp-block-column:has(> .wp-block-buttons) > .wp-block-image { position: static; }
.entry-content .wp-block-column:has(> .wp-block-buttons) > .wp-block-image a::after { content: ""; position: absolute; inset: 0; z-index: 2; }

/* The "Voir le produit" button becomes "Voir" + a cyan arrow that stretches on hover
   (inline colours saved by the editor are overridden on purpose). */
:where(.entry-content, .is-root-container) .wp-block-column:has(> .wp-block-buttons) .wp-block-button__link {
  display: inline-flex; align-items: center; gap: .5rem;
  min-height: 0; padding: .25rem 0;
  background: none !important; color: #1d1d1d !important;
  border-radius: 0; font-size: 0; letter-spacing: 0;
}
:where(.entry-content, .is-root-container) .wp-block-column:has(> .wp-block-buttons) .wp-block-button__link::before {
  content: "Voir"; font-size: .75rem; font-weight: 700; letter-spacing: .06em;
}
:where(.entry-content, .is-root-container) .wp-block-column:has(> .wp-block-buttons) .wp-block-button__link::after {
  content: ""; width: 24px; height: 10px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 10'%3E%3Cpath d='M2 1l4 4-4 4' fill='none' stroke='%231dbbff' stroke-width='2'/%3E%3C/svg%3E") right center / 8px 10px no-repeat,
    linear-gradient(#1dbbff, #1dbbff) left center / calc(100% - 2px) 2px no-repeat;
  transition: width .25s ease;
}
@media (hover: hover) {
  :where(.entry-content, .is-root-container) .wp-block-column:has(> .wp-block-buttons):hover .wp-block-button__link::after { width: 56px; }
}
:where(.entry-content, .is-root-container) .wp-block-column:has(> .wp-block-buttons) .wp-block-button__link:hover { filter: none; }

@media (max-width: 781.98px) {
  /* Product cards go two per row on phones rather than one huge card each */
  .entry-content .wp-block-columns:has(> .wp-block-column > .wp-block-buttons) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
}
