/* Couponji v3 — Divi 5 integration layer */

/* Typography: make Divi's defaults use the v3 stack */
body.cpj-site,
body.cpj-site :is(h1, h2, h3, h4, h5, h6),
body.cpj-site :is(.et_pb_module, .et_pb_text, .et_pb_button, input, textarea, select, button) {
	font-family: var(--font);
}
body.cpj-site { background: var(--ground); color: var(--text); line-height: 1.7; }
body.cpj-site :is(h1, h2, h3, h4, h5, h6) { color: var(--ink); line-height: 1.35; font-weight: 800; }
body.cpj-site a { color: var(--forest); }
body.cpj-site #page-container { background: transparent; }

/* Sections carrying v3 markup: add class "cpj" in Divi → Advanced → CSS Class.
   Spacing then comes from v3 (.section) instead of Divi defaults. */
.et_pb_section.cpj,
.et_pb_section.cpj .et_pb_row { padding: 0; }
.et_pb_section.cpj .et_pb_row { width: 100%; max-width: none; }
.et_pb_section.cpj .et_pb_module { margin-bottom: 0; }
.et_pb_section.cpj .et_pb_text_inner > :last-child { margin-bottom: 0; }

/* Divi buttons → v3 buttons */
body.cpj-site .et_pb_button {
	border-radius: var(--pill);
	border: 0;
	padding: .7em 1.6em;
	font-weight: 800;
	background: var(--sun);
	color: var(--ink);
	transition: background .2s var(--ease), transform .2s var(--ease);
}
body.cpj-site .et_pb_button:hover { background: var(--sun-hover); padding: .7em 1.6em; transform: translateY(-1px); }
body.cpj-site .et_pb_button::after { display: none; }

/* Forms */
body.cpj-site :is(input[type="text"], input[type="email"], input[type="search"], textarea) {
	border: 1px solid var(--line-strong);
	border-radius: var(--r-s);
	background: var(--surface);
}
body.cpj-site :is(input, textarea):focus { border-color: var(--forest); outline: 3px solid rgba(46, 106, 34, .18); }

/* Blog/article content keeps normal list & spacing (resets are scoped to .cpj only) */
body.cpj-site .et_pb_post_content :is(ul, ol) { padding-inline-start: 1.4em; }

/* Never show the code dialog inside the builder canvas */
.et-fb .code-dialog { display: none !important; }

/* ───────── Header (Theme Builder) ───────── */
.site-header.et_pb_section { padding: 0; background: var(--surface); border-bottom: 1px solid var(--line); position: relative; z-index: 40; }
.site-header .header-row.et_pb_row {
	display: flex; flex-wrap: nowrap; align-items: center; gap: 20px;
	width: min(1200px, 100% - 2 * var(--gutter)); max-width: none; min-height: 72px; padding: 0; margin-inline: auto;
}
/* columns: logo + country shrink to content, menu takes the rest */
.site-header .header-row > .et_pb_column { width: auto !important; max-width: none; margin: 0; padding: 0; flex: 0 0 auto; }
.site-header .header-row > .et_pb_column:nth-child(2) { flex: 1 1 auto; min-width: 0; }

/* logo */
/* Divi's image rule (width:100%) beats ours, and the img's intrinsic width stretches its column — so pin it with !important */
.site-header .header-row > .et_pb_column:first-child { flex: 0 0 136px !important; width: 136px !important; }
.site-header .brand,
.site-header .brand .et_pb_image_wrap { margin: 0; width: 136px !important; max-width: 136px !important; }
.site-header .brand img { width: 136px !important; max-width: 100% !important; height: auto !important; }

/* menu → v3 look */
.site-header .site-nav.et_pb_menu { background: none; padding: 0; margin: 0; }
.site-header .site-nav .et_pb_menu_inner_container,
.site-header .site-nav .et_pb_menu__wrap { margin: 0; padding: 0; }
.site-header .site-nav .et-menu { display: flex; flex-wrap: nowrap; gap: 4px; margin: 0; padding: 0; }
.site-header .site-nav .et-menu > li { margin: 0; padding: 0; }
.site-header .site-nav .et-menu > li > a {
	display: block; padding: 8px 12px; border-radius: var(--r-s); white-space: nowrap;
	font-weight: 600; font-size: .9375rem; color: var(--text); opacity: 1;
	transition: background .2s, color .2s;
}
.site-header .site-nav .et-menu > li > a:hover { background: var(--tint); color: var(--forest); }
.site-header .site-nav .et-menu > li.current-menu-item > a,
.site-header .site-nav .et-menu > li > a[aria-current="page"] { color: var(--forest); font-weight: 800; }

/* country: reset the Code module wrapper */
.site-header .et_pb_code, .site-header .et_pb_code_inner { margin: 0; padding: 0; }

/* mobile: use Divi's own hamburger (no custom .nav-toggle needed) */
@media (max-width: 980px) {
	.site-header .header-row.et_pb_row { gap: 10px; min-height: 64px; }
	.site-header .header-row > .et_pb_column:first-child { flex-basis: 118px !important; width: 118px !important; }
	.site-header .brand, .site-header .brand .et_pb_image_wrap { width: 118px !important; max-width: 118px !important; }
	.site-header .brand img { width: 118px !important; }
	.site-header .header-row > .et_pb_column:nth-child(2) { order: 3; flex: 0 0 auto; }
	.site-header .header-row > .et_pb_column:nth-child(3) { order: 2; margin-inline-start: auto; }
	/* neutralise the v3 prototype's absolute .site-nav (it expects .nav-toggle) */
	.site-header .site-nav { position: static; display: block; box-shadow: none; border: 0; padding: 0; background: none; }
	.site-header .site-nav .et_pb_menu__menu { display: none; }
	.site-header .site-nav .et_mobile_nav_menu { display: block; }
	.site-header .site-nav .mobile_menu_bar::before { color: var(--forest); font-size: 32px; }
	.site-header .site-nav .et_mobile_menu {
		inset-inline: 0; width: 100vw; border: 0; border-top: 1px solid var(--line);
		box-shadow: var(--shadow-2); background: var(--surface); padding: 8px var(--gutter) 16px;
	}
	.site-header .site-nav .et_mobile_menu li a { padding: 12px; font-weight: 600; color: var(--text); border-bottom: 0; }
}
@media (min-width: 981px) { .site-header .site-nav .et_mobile_nav_menu { display: none; } }
