/*
Theme Name: Construction TJL
Theme URI: https://constructiontjl.nerdmarketing.ca
Author: Nerd Marketing
Description: Custom FSE block theme for Construction TJL — Gutenberg-editable, bilingual (FR/EN via Polylang).
Version: 1.0.0
Requires at least: 6.5
Requires PHP: 8.0
Text Domain: tjl-construction
*/

html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; text-wrap: pretty; overflow-x: hidden; }
::selection { background: #2BB782; color: #FFFFFF; }

/* ---- Section utility classes (used on Group blocks via "Additional CSS class") ---- */
.tjl-dark-section { background: #003C53; }
.tjl-dark-section h1, .tjl-dark-section h2, .tjl-dark-section h3 { color: #FFFFFF; }
.tjl-dark-section p { color: rgba(255,255,255,0.72); }

.tjl-eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  color: #2BB782; margin-bottom: 16px; display: block;
}
.tjl-dark-section .tjl-eyebrow { color: #2BB782; }

.tjl-card {
  border: 1px solid #E5E5E5; background: #FFFFFF; transition: border-color 120ms ease;
}
.tjl-card:hover { border-color: #003C53; }

.tjl-photo-placeholder {
  aspect-ratio: 4/3; background: #F7F8F9; position: relative; display: flex;
  align-items: center; justify-content: center; overflow: hidden;
}
.tjl-photo-placeholder::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(135deg, transparent, transparent 14px, rgba(112,128,144,0.07) 14px, rgba(112,128,144,0.07) 15px);
}
.tjl-photo-placeholder .tjl-photo-label {
  position: relative; text-align: center; padding: 24px; font-size: 11px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: #003C53;
}

/* Hero: replicate the original design's two-layer treatment — a faint
   desaturated photo (opacity 0.28, grayscale 0.4) with a left-to-right navy
   gradient on top (near-opaque behind the text, fading to reveal more of the
   photo on the right). WP Cover's dimRatio only supports a single flat
   opacity across the whole overlay, so this overrides both layers directly. */
.tjl-hero-cover .wp-block-cover__image-background { opacity: 0.28; filter: grayscale(0.4); }
.tjl-hero-cover .wp-block-cover__background {
  opacity: 1 !important;
  background: linear-gradient(90deg, #003C53 18%, rgba(0,60,83,0.72) 60%, rgba(0,60,83,0.35) 100%) !important;
}

/* Stats bar: border goes between items on desktop (grid), between stacked
   rows on mobile — applied via the real .tjl-stat class so the media query
   below actually matches something (previously scoped to an unused
   .tjl-stat-bar wrapper that didn't exist in the markup). */
.tjl-stat:not(:last-child) { border-right: 1px solid rgba(255,255,255,0.12); }
@media (max-width: 680px) {
  .tjl-stat:not(:last-child) { border-right: none; border-bottom: 1px solid rgba(255,255,255,0.12); }
}

/*
 * WordPress's native Grid block layout ("layout":{"type":"grid"}) always
 * generates `grid-template-columns: repeat(auto-fill, ...)`, never auto-fit,
 * with no setting to change it. auto-fill reserves empty column tracks
 * whenever a row has fewer items than would fit at the container's width —
 * invisible on a dark section that blends into the surrounding background,
 * but a very visible dead strip on any section whose grid wrapper has its
 * own background color (used here to fake a 1px seam between white cards).
 * Every block using the native Grid layout gets this class + a
 * --tjl-grid-min custom property (set inline, matching minimumColumnWidth)
 * to force auto-fit instead.
 */
.tjl-grid-fit { grid-template-columns: repeat(auto-fit, minmax(min(var(--tjl-grid-min, 200px), 100%), 1fr)) !important; }
/* WP core's default `.wp-block-group.has-background{padding:1.25em 2.375em}` adds an
   unwanted frame around these card grids, which use their background color only as a
   1px seam between the white cards (via blockGap), not as padding. */
.tjl-grid-fit.has-background { padding: 0 !important; }

.tjl-num-badge { font-size: 12px; font-weight: 600; color: #708090; letter-spacing: 0.1em; }

/* Header / nav */
.tjl-header { position: sticky; top: 0; z-index: 60; background: #FFFFFF; border-bottom: 1px solid #E5E5E5; }
.tjl-nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.tjl-nav li { margin: 0; }
.tjl-nav a { text-decoration: none; }
.tjl-nav-link { display: inline-block; padding: 10px 12px; font-size: 15px; font-weight: 500; color: #708090; border-radius: 2px; text-decoration: none; }
.tjl-nav-link:hover, .tjl-nav .current-menu-item .tjl-nav-link { color: #003C53; background: #F7F8F9; font-weight: 600; }
.tjl-btn-cta {
  padding: 13px 20px; background: #2BB782; color: #FFFFFF !important; font-size: 14px; font-weight: 600;
  letter-spacing: 0.01em; border-radius: 2px; white-space: nowrap; text-decoration: none; display: inline-block;
}
.tjl-btn-cta:hover { background: #1E9168; color: #FFFFFF !important; }
.tjl-btn-cta-lg { padding: 17px 34px; font-size: 15px; }

.tjl-footer-nav .tjl-nav { flex-direction: column; align-items: flex-start; gap: 11px; }
.tjl-footer-nav .tjl-nav-link { padding: 0; color: rgba(255,255,255,0.75); font-size: 15px; font-weight: 400; background: none !important; }
.tjl-footer-nav .tjl-nav-link:hover { color: #2BB782; }
.tjl-lang-switch { display: flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid #E5E5E5; border-radius: 999px; }
.tjl-lang-switch a { padding: 6px 13px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; border-radius: 999px; color: #708090; text-decoration: none; }
.tjl-lang-switch a.is-active { background: #003C53; color: #FFFFFF; }

/* Forms */
.tjl-form-field label,
.wpcf7-form label { display: flex; flex-direction: column; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #003C53; margin-bottom: 20px; }
.wpcf7-form input[type="text"], .wpcf7-form input[type="email"], .wpcf7-form input[type="tel"],
.wpcf7-form select, .wpcf7-form textarea {
  padding: 13px 14px; border: 1px solid #E5E5E5; border-radius: 2px; font-size: 15px; color: #003C53;
  font-family: inherit; width: 100%; margin-top: 0;
}
.wpcf7-form input:focus, .wpcf7-form select:focus, .wpcf7-form textarea:focus { outline: none; border-color: #003C53; }
.wpcf7-form .wpcf7-submit {
  width: 100%; padding: 16px; background: #2BB782; color: #FFFFFF; font-size: 15px; font-weight: 600;
  border: none; border-radius: 2px; cursor: pointer;
}
.wpcf7-form .wpcf7-submit:hover { background: #1E9168; }
.tjl-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px,1fr)); gap: 20px; }
.tjl-form-box { border: 1px solid #E5E5E5; padding: clamp(22px,3vw,40px); margin-bottom: 24px; }
.tjl-form-box-title { font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: #2BB782; margin-bottom: 24px; display: block; }
.wpcf7-response-output { border: 1px solid #2BB782 !important; padding: 20px !important; margin: 20px 0 !important; color: #003C53; }
.wpcf7-not-valid-tip { color: #b64545; font-size: 13px; font-weight: 500; margin-top: 4px; }

/* Réalisations filters */
.tjl-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.tjl-filter-btn {
  padding: 11px 20px; font-size: 14px; font-weight: 600; border-radius: 2px; cursor: pointer;
  border: 1px solid #E5E5E5; background: #FFFFFF; color: #708090;
}
.tjl-filter-btn.is-active { border-color: #003C53; background: #003C53; color: #FFFFFF; }

/* Plans preview modal */
.tjl-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,60,83,0.80); z-index: 200; display: none;
  align-items: center; justify-content: center; padding: clamp(10px,3vw,40px);
}
.tjl-modal-overlay.is-open { display: flex; }
.tjl-modal-box { background: #FFFFFF; width: 100%; max-width: 1060px; max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; }
.tjl-modal-head { display: flex; align-items: center; gap: 24px; padding: 24px 32px; border-bottom: 1px solid #E5E5E5; flex-wrap: wrap; }
.tjl-modal-close { margin-left: auto; width: 38px; height: 38px; border: 1px solid #E5E5E5; background: #FFFFFF; color: #003C53; font-size: 18px; cursor: pointer; border-radius: 2px; }
.tjl-modal-body { flex: 1; overflow-y: auto; background: #F4F5F6; padding: 32px; }
.tjl-pdf-page { background: #FFFFFF; position: relative; box-shadow: 0 1px 3px rgba(0,60,83,0.18); margin: 0 auto 24px; max-width: 640px; user-select: none; }
.tjl-pdf-page canvas { display: block; width: 100%; height: auto; pointer-events: none; }
.tjl-watermark {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: none; transform: rotate(-24deg); font-size: clamp(18px,3.4vw,34px); font-weight: 600;
  letter-spacing: 0.1em; color: rgba(0,60,83,0.10); white-space: nowrap;
}
.tjl-modal-foot { flex: 0 0 auto; padding: 20px 32px; border-top: 1px solid #E5E5E5; display: flex; align-items: center; gap: 20px; background: #FFFFFF; flex-wrap: wrap; }
.tjl-plans-locked-note { border: 1px dashed #708090; padding: 28px; text-align: center; background: #FBFBFC; }
