/*
Theme Name: Site Theme
Description: Slim companion theme for a free-Elementor site: page frame, Elementor header/footer templates, "Site Menu" widget, and a CSS layer that reads the Elementor Kit.
Version: 1.0.3
Requires at least: 6.3
Requires PHP: 7.4
Text Domain: site-theme
*/

/*
 * TOKENS. Each reads the Elementor Kit global first, then a literal
 * fallback that only shows if Elementor is off. Kit ids must exist in the
 * Kit — tools/gates/theme-globals.js fails the build if one dangles.
 *
 * Declared on body as well as :root: Elementor defines the Kit variables
 * on body (.elementor-kit-N), and a var() resolves where it is declared.
 * On :root alone every token silently falls back to its literal, and Site
 * Settings never restyles the header, footer, blog or forms.
 */
:root, body {
  --st-ink: var(--e-global-color-primary, #FFFFFF);
  --st-accent: var(--e-global-color-accent, #C8161D);
  --st-text: var(--e-global-color-text, #0E1621);
  --st-paper: var(--e-global-color-brand_cream, #FFFFFF);
  --st-dark: var(--e-global-color-brand_ink, #0E1621);
  --st-heading-font: var(--e-global-typography-primary-font-family, "Archivo"), serif;
  --st-body-font: var(--e-global-typography-text-font-family, "Inter"), system-ui, sans-serif;
  --st-wrap: 1140px;
  --st-radius: 3px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--st-paper);
  color: var(--st-text);
  font-family: var(--st-body-font);
  line-height: 1.6;
}
img { max-width: 100%; height: auto; }
a { color: var(--st-accent); }

.screen-reader-text {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.st-skip:focus {
  position: fixed; top: 8px; left: 8px; z-index: 100; width: auto; height: auto;
  clip: auto; padding: 10px 16px; background: var(--st-accent); color: #fff;
}

/* Elementor owns the width of everything inside <main>. */
.st-main { display: block; }
.st-entry { max-width: 760px; margin: 0 auto; padding: 48px 18px; }

/* ---------------------------------------------------------------- header */

.st-header { position: sticky; top: 0; z-index: 60; background: var(--st-dark); }
/* Logged-in view: the admin bar is fixed above 600px and scrolls away below it,
   so the sticky offset must follow (46px left on a phone = page text above the header). */
.admin-bar .st-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .st-header { top: 46px; } }
@media (max-width: 600px) { .admin-bar .st-header { top: 0; } }
.st-headbar {
  max-width: var(--st-wrap); margin: 0 auto; padding: 12px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.st-brand { color: #fff; text-decoration: none; font-family: var(--st-heading-font); font-size: 20px; }
.st-brand img { height: 48px; width: auto; display: block; }

/* Menu: fallback header and the "Site Menu" widget share these rules. */
.st-navw { display: flex; align-items: center; justify-content: var(--st-nav-align, center); }
.st-nav ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 6px; }
.st-nav a { display: block; padding: 9px 11px; color: #fff; text-decoration: none; border-radius: var(--st-radius); }
.st-nav a:hover, .st-nav a:focus-visible { color: var(--st-accent); }
.st-nav .current-menu-item > a { color: var(--st-accent); }
.st-nav li { position: relative; }
.st-nav .sub-menu {
  display: none; position: absolute; left: 0; top: 100%; z-index: 70;
  min-width: 240px; padding: 6px 0; background: var(--st-dark);
  flex-direction: column; align-items: stretch; gap: 0;
}
.st-nav li:hover > .sub-menu, .st-nav li:focus-within > .sub-menu { display: flex; }
.st-nav .menu-item-has-children > a::after {
  content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 8px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-3px) rotate(45deg); opacity: .7;
}
.st-navw-empty { margin: 0; font-size: 13px; color: #fff; }

.st-burger {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 48px; height: 48px; padding: 0 12px; cursor: pointer;
  background: transparent; border: 1px solid currentColor; border-radius: var(--st-radius); color: #fff;
}
.st-burger span { display: block; height: 2px; background: currentColor; }
/* Fit the VISIBLE screen (dvh follows the phone's address bar) so the last
   items are not hidden under a fixed call bar; never scroll the page behind. */
.st-mobnav { max-height: calc(100vh - 96px); max-height: calc(100dvh - 96px); overflow: auto; overscroll-behavior: contain; padding: 12px 18px 22px; background: var(--st-dark); }
html.st-menu-open { overflow: hidden; }
.st-mobnav[hidden] { display: none; }
.st-mobnav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.st-mobnav .sub-menu { padding-left: 12px; }
.st-mobnav a { display: block; min-height: 48px; padding: 14px 12px; color: #fff; text-decoration: none; }

@media (max-width: 1024px) {
  .st-headbar > .st-nav { display: none; }
  .st-headbar > .st-burger { display: flex; }
}

/* Elementor header template: heading widgets take their own line height. */
.st-header .elementor-widget-heading .elementor-heading-title { display: block; }

/* ---------------------------------------------------------------- footer */

.st-footer { background: var(--st-dark); color: #fff; padding: 32px 18px; text-align: center; }
.st-footer ul { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.st-footer a { color: #fff; }

/* Footer menu columns ("Site Menu" widget, List layout). */
.st-navw.st-navw--list { display: block; }
.st-fnav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.st-fnav a { display: block; color: inherit; text-decoration: none; }
.st-fnav a:hover, .st-fnav a:focus-visible { color: var(--st-accent); }
.st-site-footer .elementor-widget-text-editor p { margin: 0; }

/* Phone call bar inside the footer template: hidden on wide screens, fixed
   on phones. The doubled class outranks Elementor's own display rule. */
.st-site-footer .e-con.st-stickybar { display: none; }
@media (max-width: 820px) {
  .st-site-footer .e-con.st-stickybar { display: grid; position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; }
  .st-template-preview .st-site-footer .e-con.st-stickybar { position: static; }
}

/*
 * ------------------------------------------------ Elementor-vs-utility fixes
 *
 * Elementor's frontend CSS loads AFTER the theme and has the same weight as
 * a one-class utility, so `.elementor img { height: auto }` and
 * `.e-con { overflow: var(--overflow) }` silently beat them. Every utility
 * that must win inside Elementor content needs extra weight, as below.
 */

/* An image widget's Height setting leaves the width at the file's own width
   (WordPress prints width/height attributes), so a 48px-tall logo renders
   1000px wide. Give such widgets the class st-img-auto. */
.elementor .elementor-widget-image.st-img-auto img { width: auto; max-width: 100%; }

/* Logo strips: a fixed-height logo. */
.st-logo.st-logo > img,
.st-logo.st-logo > a > img,
.elementor .elementor-widget-image.st-logo img { height: 40px; width: auto; max-width: 100%; object-fit: contain; }

/* Fixed-ratio thumbnails: every layer must fill the frame. */
.st-thumb { aspect-ratio: 4 / 3; overflow: hidden; }
.elementor .elementor-widget-image.st-thumb > .elementor-widget-container,
.elementor .elementor-widget-image.st-thumb a,
.elementor .elementor-widget-image.st-thumb img { display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; }

/* Scroll/clip boxes set via a class (the container setting "Overflow" is the
   editable way; this covers content imported without it). */
.e-con.st-scroll { --overflow: auto; }
.e-con.st-clip { --overflow: hidden; }

/* A table never widens the page on phones: it scrolls inside its own box. */
.elementor-widget-text-editor:has(table) { max-width: 100%; overflow-x: auto; }

/* Text widgets: the first/last paragraph adds no outer space (the source's own spacing
   is carried by container gaps and inline margins). */
.elementor-widget-text-editor p:first-child { margin-top: 0; }
.elementor-widget-text-editor p:last-child { margin-bottom: 0; }

/* header phone never wraps */
.st-nowrap, .st-nowrap * { white-space: nowrap; }
.st-nowrap p { margin: 0; }

/* Estimate form: compact 3-step card (Contact Form 7 inside an Elementor container) */
.elementor .e-con.st-estimate-card { background: #fff; color: #0e1621; border-radius: 14px; padding: 22px !important; box-shadow: 0 12px 34px rgba(14,22,33,.22); width: 100%; max-width: 440px; box-sizing: border-box; min-width: 0; align-self: flex-start; }
.st-cf7 { font-size: 15px; line-height: 1.35; }
.st-cf7 p { margin: 0; }
.st-cf7-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.st-cf7-title { font-size: 1.35rem; font-weight: 800; line-height: 1.15; }
.st-cf7-pill { background: #fdeceb; color: #a8101a; font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 6px 10px; border-radius: 999px; white-space: nowrap; }
.st-cf7-sub { color: #586273; font-size: .92rem; margin: 6px 0 12px !important; }
.st-cf7-steps { display: flex; gap: 6px; list-style: none; margin: 0 0 14px; padding: 0; }
.st-cf7-steps li { flex: 1; font-size: .74rem; font-weight: 700; color: #586273; border-top: 4px solid #dfe4ec; padding-top: 6px; }
.st-cf7-steps li.is-active { color: #0e1621; border-top-color: #c8161d; }
.st-cf7 fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.st-cf7.is-js .st-cf7-step { display: none; }
.st-cf7.is-js .st-cf7-step.is-active { display: block; }
.st-cf7 label { display: block; font-weight: 700; font-size: .85rem; margin: 0 0 10px; }
.st-cf7-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.st-cf7 input[type=text], .st-cf7 input[type=tel], .st-cf7 input[type=email], .st-cf7 select, .st-cf7 textarea { display: block; width: 100%; min-height: 44px; padding: 8px 10px; margin-top: 4px; border: 1px solid #dfe4ec; border-radius: 8px; font: inherit; font-weight: 400; background: #fff; color: #0e1621; box-sizing: border-box; }
.st-cf7 textarea { min-height: 76px; }
.st-cf7 .st-cf7-consent { font-weight: 400; font-size: .8rem; color: #586273; }
.st-cf7 .st-cf7-consent input { margin-right: 6px; }
.st-cf7 button.st-cf7-next, .st-cf7 input[type=submit] { width: 100%; min-height: 48px; border: 0; border-radius: 999px; background: #c8161d; color: #fff; font: inherit; font-weight: 800; font-size: 1rem; cursor: pointer; }
.st-cf7 button.st-cf7-back { min-height: 48px; padding: 0 18px; border: 1px solid #dfe4ec; border-radius: 999px; background: #fff; color: #0e1621; font: inherit; font-weight: 700; cursor: pointer; }
.st-cf7-nav { display: flex; gap: 10px; }
.st-cf7-nav .st-cf7-next, .st-cf7-nav input[type=submit] { flex: 1; width: auto; }
.st-cf7 button:hover, .st-cf7 input[type=submit]:hover { filter: brightness(.93); }
.st-cf7-fine { font-size: .85rem; color: #586273; margin-top: 10px !important; text-align: center; }
.st-cf7-fine a { color: #1a4fa0; font-weight: 700; }
.st-cf7 .wpcf7-not-valid-tip { color: #b00020; font-size: .78rem; }
.st-cf7 .wpcf7-spinner { display: none; }
.wpcf7 form .wpcf7-response-output { margin: 10px 0 0; border-radius: 8px; font-size: .88rem; }
@media (max-width: 480px) { .st-cf7-grid { grid-template-columns: 1fr; } }

/* In-depth guide section (Elementor widgets, light, readable) */
.st-guide .elementor-widget-text-editor { line-height: 1.7; }
.st-guide .elementor-widget-text-editor p { margin: 0 0 14px; }
.st-guide .elementor-widget-text-editor ul, .st-guide .elementor-widget-text-editor ol { margin: 0 0 14px; padding-left: 1.3em; }
.st-guide .elementor-widget-text-editor li { margin-bottom: 6px; }
.st-guide .elementor-widget-text-editor a { color: var(--e-global-color-secondary, #a8101a); text-decoration: underline; text-underline-offset: 2px; }
.st-guide .elementor-widget-heading .elementor-heading-title { text-transform: none; letter-spacing: normal; line-height: 1.2; }
.st-guide .st-guide-lead { border-left: 4px solid var(--e-global-color-accent, #c8161d); padding-left: 16px; }
.st-guide .st-sources { font-size: .95rem; }
.st-guide .elementor-widget-google_maps iframe { border-radius: 12px; }
.st-guide .elementor-accordion .elementor-tab-title { font-weight: 700; }

/* Header: keep phone and button from touching on mid-width screens */
.st-header .st-nowrap, .st-header .elementor-widget-button { flex-shrink: 0; }
.st-header .elementor-widget-site-nav-menu { min-width: 0; }
@media (max-width: 1180px) { .st-header .e-con { --gap: 10px; } .st-header .elementor-widget-site-nav-menu a { padding-left: 8px; padding-right: 8px; } }
.st-header .st-nowrap .elementor-widget-text-editor { flex: 0 0 auto; width: max-content; max-width: none; }
.st-header .st-nowrap { width: max-content; }

.st-cf7 .st-cf7-bad { border-color: #b00020 !important; box-shadow: 0 0 0 2px rgba(176,0,32,.18); }
@media (max-width: 560px) {
	.st-header .st-nowrap .elementor-widget-text-editor:last-child { display: none; }
	.st-header .st-nowrap { min-width: 44px; min-height: 44px; justify-content: center; align-items: center; }
}
