/* ============================================================
   Casse-Tête Mag — Momentus design system
   Palette: #ECF86E yellow | #2D2D2D dark | #DFECFF soft-blue
   Font: Inter (Google Fonts)
   ============================================================ */

/* ── CSS custom properties ── */
:root {
  --bg-white:    #FFFFFF;
  --bg-gray:     #F6F6F6;
  --bg-soft-blue: #DFECFF;
  --bg-dark:     #2D2D2D;
  --bg-yellow:   #ECF86E;
  --text-black:  #2D2D2D;
  --text-white:  #FFFFFF;
  --text-body:   #464646;
  --text-body-2: #A9A9A9;
  --btn-secondary: #E0E0E0;
  --radius-card: 1.25rem;
  --radius-btn:  9999px;
  --section-py:  5rem;
}

/* ── Base typography ── */
body,
.ct-container,
.entry-content {
  font-family: 'Inter', sans-serif;
  letter-spacing: -0.03em;
  color: var(--text-body);
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Inter', sans-serif;
  letter-spacing: -0.03em;
  color: var(--text-black);
  font-weight: 700;
}

h1 { font-size: clamp(2.75rem, 6vw, 4.5rem); line-height: 1; }
h2 { font-size: clamp(2rem, 5vw, 3.75rem); line-height: 1.2; }
h3 { font-size: clamp(1.75rem, 4vw, 3.25rem); line-height: 1.23; }
h4 { font-size: clamp(1.5rem, 3vw, 3rem); line-height: 1.17; }
h5 { font-size: clamp(1.25rem, 2.5vw, 2.25rem); line-height: 1.22; }
h6 { font-size: clamp(1.1rem, 2vw, 1.5rem); line-height: 1.33; }

/* Mobile scale */
@media (max-width: 689.98px) {
  h1 { font-size: clamp(1.75rem, 10vw, 2.75rem); }
  h2 { font-size: clamp(1.5rem, 8vw, 2.25rem); }
  h3 { font-size: clamp(1.25rem, 6vw, 1.75rem); }
}

/* ── FIX #1: Hide Blocksy default hero/entry-header title bands ── */
.hero-section,
.entry-header > .page-title,
header.entry-header {
  display: none !important;
}

/* ── FIX #2: Featured image on single posts ── */
.ot-single-featured-wrap {
  margin: 0 0 2rem 0;
  overflow: hidden;
  border-radius: var(--radius-card);
}
.ot-single-featured-wrap .ot-single-featured {
  display: block;
  width: 100%;
  height: auto;
  max-height: 480px;
  object-fit: cover;
}
@media (max-width: 689.98px) {
  .ot-single-featured-wrap { border-radius: 0.5rem; margin-bottom: 1.5rem; }
  .ot-single-featured-wrap .ot-single-featured { max-height: 280px; }
}

/* ── FIX #3: Blog archive 2 columns ── */
html [data-prefix="categories"] .entries,
html [data-prefix="blog"] .entries,
html [data-prefix="search"] .entries {
  --grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 689.98px) {
  html [data-prefix="categories"] .entries,
  html [data-prefix="blog"] .entries,
  html [data-prefix="search"] .entries {
    --grid-template-columns: repeat(1, minmax(0, 1fr));
  }
}

/* ── FIX #4: Blog card title size ── */
[data-prefix="blog"] .entry-card .entry-title,
[data-prefix="categories"] .entry-card .entry-title,
[data-prefix="search"] .entry-card .entry-title {
  --theme-font-size: 17px;
  --theme-line-height: 1.25;
  --theme-font-weight: 600;
}
@media (max-width: 999.98px) {
  [data-prefix="blog"] .entry-card .entry-title,
  [data-prefix="categories"] .entry-card .entry-title,
  [data-prefix="search"] .entry-card .entry-title {
    --theme-font-size: 16px;
  }
}
@media (max-width: 689.98px) {
  [data-prefix="blog"] .entry-card .entry-title,
  [data-prefix="categories"] .entry-card .entry-title,
  [data-prefix="search"] .entry-card .entry-title {
    --theme-font-size: 15px;
  }
}

/* ── Button system — context-aware contrast ── */
/* Base shape + transition */
.wp-block-button .wp-block-button__link,
.ct-button,
button.ct-button {
  border-radius: 9999px !important;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
  transition: background-color 0.2s ease, color 0.2s ease;
  border: none !important;
}

/* Light section (white / gray / soft-blue): yellow bg, dark text */
.wp-block-button .wp-block-button__link {
  background-color: #ECF86E !important;
  color: #2D2D2D !important;
  padding: 0.8rem 1.75rem;
}
.wp-block-button .wp-block-button__link:hover,
.wp-block-button .wp-block-button__link:focus {
  background-color: #2D2D2D !important;
  color: #FFFFFF !important;
}

/* Dark section (section-dark, hero cover): white bg, dark text → hover yellow */
.section-dark .wp-block-button .wp-block-button__link,
.wp-block-cover.is-dark .wp-block-cover__inner-container .wp-block-button .wp-block-button__link {
  background-color: #FFFFFF !important;
  color: #2D2D2D !important;
}
.section-dark .wp-block-button .wp-block-button__link:hover,
.section-dark .wp-block-button .wp-block-button__link:focus,
.wp-block-cover.is-dark .wp-block-cover__inner-container .wp-block-button .wp-block-button__link:hover,
.wp-block-cover.is-dark .wp-block-cover__inner-container .wp-block-button .wp-block-button__link:focus {
  background-color: #ECF86E !important;
  color: #2D2D2D !important;
}

/* Yellow section (section-yellow): dark bg, white text → hover white */
.section-yellow .wp-block-button .wp-block-button__link {
  background-color: #2D2D2D !important;
  color: #FFFFFF !important;
}
.section-yellow .wp-block-button .wp-block-button__link:hover,
.section-yellow .wp-block-button .wp-block-button__link:focus {
  background-color: #FFFFFF !important;
  color: #2D2D2D !important;
}

/* ── Header: dark background — Blocksy uses data-id="type-1" on header.ct-header ── */
header.ct-header,
header.ct-header [data-row],
#header,
#header [data-row] {
  background-color: var(--bg-dark) !important;
}
/* Menu links + brand text white */
header.ct-header .ct-menu-link,
header.ct-header .site-title a,
header.ct-header .ct-label,
header.ct-header .site-description,
header.ct-header a {
  color: var(--text-white) !important;
}
/* Hover: yellow accent */
header.ct-header .ct-menu-link:hover,
header.ct-header .current-menu-item > .ct-menu-link {
  color: var(--bg-yellow) !important;
}
/* Icons (search, hamburger) */
header.ct-header .ct-icon,
header.ct-header svg,
header.ct-header svg path,
header.ct-header svg rect {
  fill: var(--text-white) !important;
  color: var(--text-white) !important;
}

/* FIX #6: Dropdown nav styling */
.sub-menu {
  background-color: var(--bg-dark) !important;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0.5rem;
}
.sub-menu li a,
.ct-header .sub-menu .ct-menu-link {
  color: var(--text-white) !important;
  padding: 0.5rem 1rem;
}
.sub-menu li a:hover,
.ct-header .sub-menu .ct-menu-link:hover {
  color: var(--bg-yellow) !important;
  background: rgba(255,255,255,0.05);
}

/* ── Footer: dark background + 4-column grid ── */
#footer,
.ct-footer,
.site-footer {
  background-color: var(--bg-dark) !important;
  color: var(--text-white);
  padding-top: 4rem;
  padding-bottom: 2rem;
}
/* 4-column widget grid */
.ct-footer [data-row="middle"] .ct-container {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 2.5rem;
  align-items: start;
}
@media (max-width: 999.98px) {
  .ct-footer [data-row="middle"] .ct-container {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 2rem;
  }
}
@media (max-width: 689.98px) {
  .ct-footer [data-row="middle"] .ct-container {
    grid-template-columns: 1fr !important;
  }
}
/* Footer widget columns fill full width */
.ct-footer [data-row="middle"] [data-column] {
  width: 100%;
}
footer.ct-footer,
footer.ct-footer .ct-widget,
footer.ct-footer .textwidget,
footer.ct-footer address,
footer.ct-footer p,
footer.ct-footer strong,
footer.ct-footer span,
footer.ct-footer li,
#footer p,
#footer address,
#footer span,
#footer li {
  color: #FFFFFF !important;
}
footer.ct-footer a:not(.ct-button),
#footer a,
.ct-footer a,
.site-footer a {
  color: #FFFFFF !important;
}
footer.ct-footer a:not(.ct-button):hover,
#footer a:hover,
.ct-footer a:hover,
.site-footer a:hover {
  color: #ECF86E !important;
}
footer.ct-footer .widget-title,
#footer h3,
#footer h4,
.ct-footer h3,
.ct-footer h4,
.ct-footer .widget-title {
  color: #ECF86E !important;
}

/* FIX #9: No giant footer watermark */
.footer-wordmark {
  display: none !important;
}

/* Hero cover: force dark overlay (contrast palette = white, need black) */
.section-dark .wp-block-cover__background,
.wp-block-cover.is-dark .wp-block-cover__background {
  background-color: rgba(0,0,0,0.5) !important;
}

/* ── Fix C: Content links — dark text + yellow underline accent ── */
.entry-content a:not(.wp-block-button__link):not(.ct-button):not(.ff-btn) {
  color: #2D2D2D;
  text-decoration: underline;
  text-decoration-color: #ECF86E;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.entry-content a:not(.wp-block-button__link):not(.ct-button):not(.ff-btn):hover {
  color: #ECF86E;
  text-decoration-color: #2D2D2D;
}

/* ── Newsletter form: constrain width + center ── */
.section-yellow .fluentform {
  max-width: 480px;
  margin: 1.5rem auto 0;
}

/* ── Fix D: Fluent Forms fields ── */
.fluentform .ff-el-input--label label {
  color: #2D2D2D !important;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.fluentform .ff-el-form-control,
.fluentform input[type="text"],
.fluentform input[type="email"],
.fluentform input[type="tel"],
.fluentform textarea {
  background-color: #FFFFFF !important;
  color: #2D2D2D !important;
  border: 1px solid #DDDDDD !important;
  border-radius: 0.5rem !important;
  padding: 0.75rem 1rem !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 1rem !important;
  width: 100% !important;
}
.fluentform .ff-el-form-control:focus,
.fluentform input:focus,
.fluentform textarea:focus {
  border-color: #ECF86E !important;
  outline: 2px solid #ECF86E !important;
  outline-offset: 0;
}
.section-dark .fluentform .ff-el-input--label label,
.wp-block-cover.is-dark .fluentform .ff-el-input--label label {
  color: #FFFFFF !important;
}
.section-yellow .fluentform .ff-el-input--label label {
  color: #2D2D2D !important;
}

/* ── Fix B: Fluent Forms submit button — match global button system ── */
.fluentform .ff-btn-submit,
.fluentform button.ff-btn {
  background-color: #ECF86E !important;
  color: #2D2D2D !important;
  border: none !important;
  border-radius: 9999px !important;
  padding: 0.75rem 2rem !important;
  font-weight: 600 !important;
  font-family: 'Inter', sans-serif !important;
  transition: background-color 0.2s, color 0.2s;
}
.fluentform .ff-btn-submit:hover,
.fluentform .ff-btn-submit:focus,
.fluentform button.ff-btn:hover,
.fluentform button.ff-btn:focus {
  background-color: #2D2D2D !important;
  color: #FFFFFF !important;
}
.section-dark .fluentform .ff-btn-submit,
.section-dark .fluentform button.ff-btn,
.wp-block-cover.is-dark .fluentform .ff-btn-submit {
  background-color: #FFFFFF !important;
  color: #2D2D2D !important;
}
.section-dark .fluentform .ff-btn-submit:hover,
.section-dark .fluentform .ff-btn-submit:focus {
  background-color: #ECF86E !important;
  color: #2D2D2D !important;
}
.section-yellow .fluentform .ff-btn-submit,
.section-yellow .fluentform button.ff-btn {
  background-color: #2D2D2D !important;
  color: #FFFFFF !important;
}
.section-yellow .fluentform .ff-btn-submit:hover,
.section-yellow .fluentform .ff-btn-submit:focus {
  background-color: #FFFFFF !important;
  color: #2D2D2D !important;
}

/* ── Cards: rounded corners ── */
.entry-card,
.wp-block-group.is-style-card,
.ct-card {
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.entry-card img,
.wp-block-image img {
  border-radius: var(--radius-card);
}

/* ── Sections vertical rhythm ── */
.wp-block-group.alignfull {
  padding-top: var(--section-py);
  padding-bottom: var(--section-py);
}
@media (max-width: 689.98px) {
  .wp-block-group.alignfull {
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
  }
}

/* ── Accent band: soft-blue ── */
.section-soft-blue {
  background-color: var(--bg-soft-blue) !important;
}

/* ── Yellow CTA band ── */
.section-yellow {
  background-color: var(--bg-yellow) !important;
  color: var(--text-black);
}
.section-yellow h2,
.section-yellow h3,
.section-yellow p {
  color: var(--text-black) !important;
}

/* ── Dark band ── */
.section-dark {
  background-color: var(--bg-dark) !important;
  color: var(--text-white);
}
.section-dark h2,
.section-dark h3,
.section-dark p {
  color: var(--text-white) !important;
}

/* ── Gray alternate band ── */
.section-gray {
  background-color: var(--bg-gray) !important;
}

/* ── Single post: readable content column ── */
.single .entry-content {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}
.single .entry-content h2 {
  font-size: clamp(1.4rem, 3vw, 1.75rem);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}
.single .entry-content p {
  font-size: 1.0625rem;
  line-height: 1.75;
  margin-bottom: 1.25rem;
}

/* ── Quiz block ── */
.ot-quiz {
  background: var(--bg-gray);
  border-radius: var(--radius-card);
  padding: 2rem;
  margin: 2rem 0;
}

/* ── Fluent Forms styling ── */
.ff-el-input--label label {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  color: var(--text-black);
  letter-spacing: -0.02em;
}
.ff-el-form-control {
  border-radius: 0.5rem !important;
  border: 1.5px solid #D1D5DB;
  font-family: 'Inter', sans-serif;
  padding: 0.75rem 1rem;
  transition: border-color 0.2s;
}
.ff-el-form-control:focus {
  border-color: var(--bg-dark);
  outline: none;
}
.ff-btn-submit {
  background-color: var(--bg-dark) !important;
  color: var(--text-white) !important;
  border-radius: var(--radius-btn) !important;
  font-family: 'Inter', sans-serif !important;
  font-weight: 600 !important;
  padding: 0.8rem 2rem !important;
  transition: background-color 0.2s, color 0.2s !important;
}
.ff-btn-submit:hover {
  background-color: var(--bg-yellow) !important;
  color: var(--text-black) !important;
}

/* ── Utility classes used in page blocks ── */
.text-yellow  { color: var(--bg-yellow) !important; }
.text-dark    { color: var(--text-black) !important; }
.text-white   { color: var(--text-white) !important; }
.text-muted   { color: var(--text-body-2) !important; }
.font-bold    { font-weight: 700 !important; }
.font-semibold { font-weight: 600 !important; }

/* ── Recent posts grid (homepage) — responsive ── */
.ot-recent-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
@media (max-width: 999.98px) {
  .ot-recent-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 689.98px) {
  .ot-recent-grid { grid-template-columns: 1fr; }
}

/* ── Articles récents: 6-col single row on desktop ── */
.ot-articles-row .wp-block-post-template.is-layout-grid,
.ot-articles-row .wp-block-post-template {
  display: grid !important;
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  gap: 1rem !important;
}
@media (max-width: 999.98px) {
  .ot-articles-row .wp-block-post-template.is-layout-grid,
  .ot-articles-row .wp-block-post-template {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 689.98px) {
  .ot-articles-row .wp-block-post-template.is-layout-grid,
  .ot-articles-row .wp-block-post-template {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
/* Smaller title in 6-col to avoid text overflow */
.ot-articles-row .wp-block-post-title {
  font-size: 0.875rem !important;
  line-height: 1.2 !important;
  font-weight: 600 !important;
}
.ot-articles-row .wp-block-post-excerpt {
  display: none !important;
}
.ot-articles-row .wp-block-post-featured-image img {
  height: 140px !important;
  object-fit: cover !important;
}

/* ── Fun-facts strip ── */
.ot-fun-fact-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.ot-fun-fact-strip .fact-card {
  background: var(--bg-white);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
@media (max-width: 689.98px) {
  .ot-fun-fact-strip { grid-template-columns: 1fr; }
}

/* ── Breadcrumb ── */
.ct-breadcrumbs {
  font-size: 0.85rem;
  color: var(--text-body-2);
  letter-spacing: -0.01em;
}

/* ── Category archive header ── */
[data-prefix="categories"] .page-header,
[data-prefix="blog"] .page-header {
  background: var(--bg-gray);
  padding: 3rem 0;
  text-align: center;
}

/* Articles récents — single visual row of 6 on desktop, scroll on smaller */
.wp-block-query .wp-block-post-template.is-layout-grid,
.wp-block-query .wp-block-post-template,
.ot-recent-posts-grid {
  display: grid !important;
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  gap: 1.25rem !important;
}
@media (max-width: 1199.98px) {
  .wp-block-query .wp-block-post-template.is-layout-grid,
  .wp-block-query .wp-block-post-template,
  .ot-recent-posts-grid {
    grid-template-columns: none !important;
    grid-auto-flow: column !important;
    grid-auto-columns: minmax(240px, 1fr) !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory;
    padding-bottom: 1rem;
  }
  .wp-block-query .wp-block-post-template > *,
  .ot-recent-posts-grid > * {
    scroll-snap-align: start;
  }
}

/* Articles récents homepage — body.home scoped so archives are unaffected */
body.home .wp-block-query .wp-block-post-template {
  display: grid !important;
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  gap: 1.25rem !important;
}
@media (max-width: 1199.98px) {
  body.home .wp-block-query .wp-block-post-template {
    grid-template-columns: none !important;
    grid-auto-flow: column !important;
    grid-auto-columns: minmax(240px, 1fr) !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory;
    padding-bottom: 1rem;
  }
  body.home .wp-block-query .wp-block-post-template > * { scroll-snap-align: start; }
}
