/*
  Northerns Inc modern layer

  This stylesheet intentionally overrides the stock Catch Flames presentation
  without changing WordPress content structure.
*/

body.nsi-modern {
  --nsi-bg: #0b1f1b;
  --nsi-paper: #fbfaf6;
  --nsi-ink: #10211c;
  --nsi-ink-soft: rgba(16, 33, 28, 0.72);
  --nsi-border: rgba(16, 33, 28, 0.12);
  --nsi-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);

  --nsi-pine: #0f3a32;
  --nsi-water: #0b6670;
  --nsi-brass: #c38b2e;

  --nsi-radius: 16px;
  --nsi-radius-sm: 12px;

  color: var(--nsi-ink);
  font-family: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: -0.01em;
}

body.nsi-modern.custom-background {
  background-color: #0b1f1b !important;
  background-blend-mode: multiply;
}

/* Reduce jank on mobile when theme uses fixed background. */
@media (max-width: 900px) {
  body.nsi-modern.custom-background {
    background-attachment: scroll !important;
  }
}

/* Add a subtle overlay to improve readability on busy backgrounds. */
body.nsi-modern.custom-background:before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(1200px 800px at 20% 10%, rgba(195, 139, 46, 0.18), rgba(0, 0, 0, 0)),
    radial-gradient(1000px 700px at 85% 20%, rgba(11, 102, 112, 0.20), rgba(0, 0, 0, 0)),
    linear-gradient(180deg, rgba(11, 31, 27, 0.72), rgba(11, 31, 27, 0.35) 35%, rgba(11, 31, 27, 0.78));
  z-index: 0;
}

/* Ensure page content sits above overlay. */
body.nsi-modern #page {
  position: relative;
  z-index: 1;
}

/* Constrain and modernize the layout width. */
body.nsi-modern .wrapper {
  width: min(1120px, calc(100% - 40px));
}

@media (max-width: 520px) {
  body.nsi-modern .wrapper {
    width: min(1120px, calc(100% - 28px));
  }
}

/* Header: glassy bar, show title again even if WP custom header hides it. */
body.nsi-modern #branding {
  background: transparent;
}

body.nsi-modern #header-content {
  padding: 14px 0 8px;
  background: linear-gradient(
    180deg,
    rgba(11, 31, 27, 0.78),
    rgba(11, 31, 27, 0.46)
  );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Remove the large header image for a cleaner modern layout. */
body.nsi-modern #header-image {
  display: none;
}

/* Header search (top-right widget) */
body.nsi-modern #sidebar-header-right {
  float: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

body.nsi-modern #sidebar-header-right .widget {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
}

body.nsi-modern #sidebar-header-right #searchform {
  margin: 0;
}

body.nsi-modern #sidebar-header-right #searchform input#s {
  width: 220px;
  max-width: 55vw;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  padding: 9px 14px;
}

body.nsi-modern #sidebar-header-right #searchform input#s::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

@media (max-width: 900px) {
  body.nsi-modern #sidebar-header-right #searchform input#s {
    width: 160px;
  }
}

body.nsi-modern #logo-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

body.nsi-modern .nsi-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

body.nsi-modern .nsi-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  color: rgba(251, 250, 246, 0.92);
  background: rgba(251, 250, 246, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
}

body.nsi-modern .nsi-mark svg {
  width: 26px;
  height: 26px;
  display: block;
  transform: translateX(-1px);
}

body.nsi-modern #site-details {
  position: static !important;
  clip: auto !important;
  width: auto !important;
  height: auto !important;
  overflow: visible !important;
}

body.nsi-modern #site-title {
  font-family: Fraunces, Georgia, serif;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

body.nsi-modern #site-title a {
  color: var(--nsi-paper);
  text-decoration: none;
}

body.nsi-modern #site-description {
  margin-top: 4px;
  color: rgba(251, 250, 246, 0.74);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Menu bar */
body.nsi-modern #header-menu {
  background: rgba(11, 31, 27, 0.76);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(0, 0, 0, 0.28);
}

body.nsi-modern #header-menu #access {
  background: transparent;
}

body.nsi-modern #header-menu ul.menu > li > a {
  color: rgba(251, 250, 246, 0.94);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
  line-height: 3.8em;
  padding: 0 16px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.32);
}

body.nsi-modern #header-menu ul.menu > li:hover > a,
body.nsi-modern #header-menu ul.menu > li > a:focus {
  background: rgba(251, 250, 246, 0.12);
  color: #fff;
}

/* Dropdown menus */
body.nsi-modern #header-menu ul.menu ul {
  background: rgba(251, 250, 246, 0.98);
  border: 1px solid rgba(16, 33, 28, 0.16);
  border-radius: 14px;
  padding: 8px;
  margin-top: 0;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
}

/* Ensure dropdowns are visible and clickable (not clipped/hidden). */
body.nsi-modern #header-menu {
  position: relative;
  z-index: 1000;
}

body.nsi-modern #header-menu ul.menu {
  position: relative;
  z-index: 2;
}

body.nsi-modern #header-menu ul.menu ul {
  top: 100% !important;
  left: 0 !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px);
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    visibility 0s linear 160ms;
}

body.nsi-modern #header-menu ul.menu li:hover > ul,
body.nsi-modern #header-menu ul.menu li.focus > ul {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition-delay: 0s;
}

body.nsi-modern #header-menu ul.menu ul a {
  background: transparent;
  border: none;
  color: rgba(16, 33, 28, 0.92);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.02em;
  line-height: 1.3;
  padding: 10px 12px;
}

body.nsi-modern #header-menu ul.menu ul li a:hover,
body.nsi-modern #header-menu ul.menu ul li a:focus {
  background: rgba(11, 102, 112, 0.10);
  color: rgba(11, 31, 27, 0.98);
  text-decoration: none;
}

/* Main content shell */
body.nsi-modern #main {
  background: transparent;
  padding-top: 28px;
}

/* Home: Catch Flames can output an empty featured-content band; hide it. */
body.nsi-modern #featured-content {
  display: none;
}

/* Subpages: center content and avoid awkward sidebar layout. */
@media (min-width: 900px) {
  body.nsi-modern #secondary {
    display: none;
  }

  body.nsi-modern .content-sidebar-wrap {
    float: none;
    width: 100%;
  }

  body.nsi-modern #primary {
    float: none;
    width: 100%;
  }
}

/* Mobile: hide sidebar widgets (menu/newsletter) to match desktop intent. */
@media (max-width: 899px) {
  body.nsi-modern #secondary {
    display: none;
  }

  body.nsi-modern .content-sidebar-wrap {
    float: none;
    width: 100%;
  }

  body.nsi-modern #primary {
    float: none;
    width: 100%;
  }
}

body.nsi-modern .hentry,
body.nsi-modern .widget,
body.nsi-modern .no-results,
body.nsi-modern #comments {
  background: rgba(251, 250, 246, 0.92);
  border: 1px solid var(--nsi-border);
  border-radius: var(--nsi-radius);
  box-shadow: var(--nsi-shadow);
}

body.nsi-modern .entry-title {
  font-family: Fraunces, Georgia, serif;
  font-size: 34px;
  line-height: 1.12;
  letter-spacing: -0.03em;
}

body.nsi-modern .entry-title a {
  color: var(--nsi-ink);
}

body.nsi-modern .entry-content,
body.nsi-modern .entry-summary {
  padding-top: 14px;
}

body.nsi-modern .entry-content p,
body.nsi-modern .entry-summary p {
  color: var(--nsi-ink-soft);
  font-size: 17px;
  line-height: 1.75;
}

body.nsi-modern .entry-content h2,
body.nsi-modern .entry-content h3,
body.nsi-modern .entry-content h4 {
  font-family: Fraunces, Georgia, serif;
  letter-spacing: -0.02em;
}

/* Buttons (Gutenberg) */
body.nsi-modern .wp-block-button__link {
  background: linear-gradient(135deg, var(--nsi-water), var(--nsi-pine));
  color: #fff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(11, 102, 112, 0.28);
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  font-size: 12px;
  padding: 14px 18px;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    filter 140ms ease;
}

body.nsi-modern .wp-block-button__link:hover,
body.nsi-modern .wp-block-button__link:focus {
  transform: translateY(-1px);
  box-shadow: 0 16px 40px rgba(11, 102, 112, 0.30);
  filter: brightness(1.04);
}

body.nsi-modern .wp-block-button__link:active {
  transform: translateY(0);
  box-shadow: 0 10px 26px rgba(11, 102, 112, 0.22);
}

/* Home: give breathing room between CTA and next section heading */
body.nsi-modern.home .wp-block-buttons {
  margin-bottom: 18px;
}

body.nsi-modern.home h2.wp-block-heading {
  margin-top: 18px;
}

/* MaxButtons plugin: normalize to match the home CTA */
body.nsi-modern a.maxbutton,
body.nsi-modern a.maxbutton:visited {
  background: linear-gradient(135deg, var(--nsi-water), var(--nsi-pine)) !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  border-radius: 999px !important;
  box-shadow: 0 12px 30px rgba(11, 102, 112, 0.28) !important;
  height: auto !important;
  width: auto !important;
  padding: 12px 16px !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    filter 140ms ease;
}

@media (max-width: 600px) {
  /* Stack CTA buttons cleanly on small screens (e.g., About page). */
  body.nsi-modern .entry-content a.maxbutton,
  body.nsi-modern .entry-content a.maxbutton:visited {
    width: min(92%, 360px) !important;
    margin: 12px auto !important;
    justify-content: center !important;
  }
}

body.nsi-modern a.maxbutton .mb-text {
  color: #fff !important;
  font-family: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  letter-spacing: 0.10em !important;
  text-transform: uppercase !important;
  line-height: 1.1 !important;
  padding: 0 !important;
  text-shadow: none !important;
}

body.nsi-modern a.maxbutton:hover,
body.nsi-modern a.maxbutton:focus {
  transform: translateY(-1px);
  box-shadow: 0 16px 40px rgba(11, 102, 112, 0.30) !important;
  filter: brightness(1.04);
}

body.nsi-modern a.maxbutton:active {
  transform: translateY(0);
  box-shadow: 0 10px 26px rgba(11, 102, 112, 0.22) !important;
}

/* Plain PDF links: present as CTAs on subpages */
body.nsi-modern .entry-content a[href$=".pdf"] {
  background: linear-gradient(135deg, var(--nsi-water), var(--nsi-pine));
  color: #fff;
  border-radius: 999px;
  padding: 12px 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    filter 140ms ease;
}

body.nsi-modern .entry-content a[href$=".pdf"]:hover,
body.nsi-modern .entry-content a[href$=".pdf"]:focus {
  transform: translateY(-1px);
  box-shadow: 0 16px 40px rgba(11, 102, 112, 0.30);
  filter: brightness(1.04);
}

body.nsi-modern .entry-content a[href$=".pdf"]:active {
  transform: translateY(0);
  box-shadow: 0 10px 26px rgba(11, 102, 112, 0.22);
}

/* Buttons (theme + plugins): match the home CTA */
body.nsi-modern :is(
  a.button,
  .button,
  button,
  input[type="submit"],
  input[type="button"],
  input[type="reset"],
  a.more-link
) {
  background: linear-gradient(135deg, var(--nsi-water), var(--nsi-pine)) !important;
  color: #fff !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  border-radius: 999px !important;
  box-shadow: 0 12px 30px rgba(11, 102, 112, 0.28) !important;
  font-weight: 800 !important;
  letter-spacing: 0.10em !important;
  text-transform: uppercase !important;
  font-size: 12px !important;
  padding: 12px 16px !important;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

body.nsi-modern :is(
  a.button,
  .button,
  button,
  input[type="submit"],
  input[type="button"],
  input[type="reset"],
  a.more-link
):hover,
body.nsi-modern :is(
  a.button,
  .button,
  button,
  input[type="submit"],
  input[type="button"],
  input[type="reset"],
  a.more-link
):focus {
  filter: brightness(1.04);
}

body.nsi-modern .wp-block-button__link:hover,
body.nsi-modern .wp-block-button__link:focus {
  text-decoration: none;
  filter: brightness(1.04);
}

/* Lists */
body.nsi-modern .entry-content ul.wp-block-list {
  margin-left: 22px;
}

body.nsi-modern .entry-content ul.wp-block-list li {
  margin: 10px 0;
}

/* "What We Do" columns: cardify */
body.nsi-modern .wp-block-columns {
  gap: 18px;
}

body.nsi-modern .wp-block-column {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(16, 33, 28, 0.10);
  border-radius: var(--nsi-radius-sm);
  padding: 18px 18px 8px;
}

body.nsi-modern .wp-block-column h3 {
  margin-top: 0;
}

/* Home: remove redundant sidebar and let content breathe */
@media (min-width: 900px) {
  body.nsi-modern.home #secondary {
    display: none;
  }

  body.nsi-modern.home #primary {
    float: none;
    width: 100%;
  }
}

/* Sidebar: keep newsletter, hide duplicated menu widget */
@media (min-width: 900px) {
  body.nsi-modern #secondary .widget.widget_nav_menu {
    display: none;
  }
}

/* Footer */
body.nsi-modern #footer-sidebar,
body.nsi-modern #site-generator {
  background: rgba(11, 31, 27, 0.86);
  border-top: 1px solid rgba(255, 255, 255, 0.10);
}

/* Remove empty footer widget band for a tighter page end. */
body.nsi-modern #footer-sidebar {
  display: none;
}

body.nsi-modern #site-generator {
  color: rgba(251, 250, 246, 0.80);
}

/* Hide upstream theme credit for a cleaner footer. */
body.nsi-modern #site-generator .powered {
  display: none;
}

body.nsi-modern #site-generator a {
  color: rgba(251, 250, 246, 0.95);
}

/* Forms */
body.nsi-modern input[type="text"],
body.nsi-modern input[type="email"],
body.nsi-modern input[type="url"],
body.nsi-modern input[type="password"],
body.nsi-modern textarea {
  border-radius: 10px;
  border: 1px solid rgba(16, 33, 28, 0.16);
  padding: 10px 12px;
}

body.nsi-modern .widget .widget-title {
  font-family: Fraunces, Georgia, serif;
  font-size: 18px;
  letter-spacing: -0.02em;
  border-bottom-color: rgba(16, 33, 28, 0.18);
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  body.nsi-modern * {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
