/* mobile.min.css — tightening overlay loaded after design-system.css
   Two jobs:
   (1) Reset <button class="so-btn"> so it visually matches the old <a class="so-btn"> exactly
   (2) Fix mobile-specific gaps in the existing responsive rules
*/

/* ============================================================
   (1) Button-as-CTA reset
   <button> has default user-agent styling that <a> doesn't.
   Wipe it so visual parity with the design system is preserved.
   ============================================================ */
button.so-btn,
button.so-btn-primary,
button.so-btn-secondary,
button.so-sidebar-cta {
  font-family: inherit;
  font-size: inherit;
  line-height: 1.2;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  text-align: center;
}

/* Restore the .so-btn look since UA reset wiped it.
   These mirror the styles applied to <a class="so-btn"> in design-system.css. */
button.so-btn,
button.so-btn-primary,
button.so-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  min-height: 48px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  transition: transform 0.12s, box-shadow 0.2s, background 0.15s, color 0.15s;
}

button.so-btn-primary {
  background: #2E8B6E;
  color: var(--n-0);
  box-shadow: 0 2px 0 rgba(0,0,0,0.1), 0 8px 24px rgba(46,139,110,0.35);
}
button.so-btn-primary:hover,
button.so-btn-primary:focus-visible {
  background: #1F6B53;
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(46,139,110,0.5);
}

button.so-btn-secondary {
  background: var(--n-0);
  color: var(--n-900);
  border: 2px solid var(--n-900);
}
button.so-btn-secondary:hover,
button.so-btn-secondary:focus-visible {
  background: var(--n-900);
  color: var(--n-0);
}

/* CTA-band button override (white on magenta background) */
.so-cta-band button.so-btn-primary,
.so-cta-inner button.so-btn-primary {
  background: var(--n-0);
  color: var(--n-900);
  font-size: 1.0625rem;
  padding: 18px 32px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.25);
}
.so-cta-band button.so-btn-primary:hover,
.so-cta-band button.so-btn-primary:focus-visible,
.so-cta-inner button.so-btn-primary:hover,
.so-cta-inner button.so-btn-primary:focus-visible {
  background: var(--c-yellow);
  color: var(--n-900);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.3);
}

/* Sidebar CTA button — white on magenta sidebar block */
button.so-sidebar-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 14px 16px;
  background: var(--n-0);
  color: var(--n-900);
  font-weight: 700;
  font-size: 0.9375rem;
  border-radius: var(--radius-md);
  position: relative;
  z-index: 1;
  transition: background 0.15s, transform 0.15s, color 0.15s;
}
button.so-sidebar-cta:hover,
button.so-sidebar-cta:focus-visible {
  background: var(--c-yellow);
  color: var(--n-900);
  transform: translateY(-2px);
}

/* Focus outline for buttons */
button.so-btn:focus-visible,
button.so-btn-primary:focus-visible,
button.so-btn-secondary:focus-visible,
button.so-sidebar-cta:focus-visible {
  outline: 2px solid var(--c-cyan);
  outline-offset: 3px;
}


/* ============================================================
   (2) Mobile tightening
   The design system already handles 900px and 768px breakpoints
   but a few areas need more attention on real phones (375-414px).
   ============================================================ */

/* Slightly tighter container padding at common phone widths */
@media (max-width: 600px) {
  .so-hero { padding: 40px 20px 32px; }
  .so-hero h1 {
    font-size: clamp(1.875rem, 7vw, 2.25rem);
    line-height: 1.1;
  }
  .so-hero p.so-hero-lede {
    font-size: 1.0625rem;
    line-height: 1.5;
  }

  .so-section { padding: 48px 0; }
  .so-section-inner { padding: 0 20px; }

  .so-cta-inner { padding: 40px 20px; }
  .so-cta-inner h2 { font-size: 1.625rem; }
  .so-cta-inner p { font-size: 1rem; }

  .so-footer-inner { padding: 0 20px; gap: 28px; }

  /* Hero trust items — wrap and tighten */
  .so-hero-trust { gap: 8px; margin-top: 20px; }
  .so-hero-trust-item {
    font-size: 0.8125rem;
    padding: 8px 14px;
  }

  /* CTAs — stack full width on small phones */
  .so-hero-ctas {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .so-hero-ctas .so-btn,
  .so-hero-ctas button.so-btn,
  .so-hero-ctas .so-btn-primary,
  .so-hero-ctas .so-btn-secondary,
  .so-hero-ctas button.so-btn-primary,
  .so-hero-ctas button.so-btn-secondary {
    width: 100%;
  }

  /* Service grid → single column on phones */
  .so-service-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .so-service-card { padding: 22px; }

  /* Stat box smaller on phones */
  .so-stat-box {
    padding: 20px 22px;
    margin: 28px 0;
  }
  .so-stat-box .num { font-size: 1.875rem; }

  /* Trust bar stacks on phones (already in design-system at 768, but tighten padding) */
  .so-trust-bar {
    padding: 24px 20px;
    gap: 10px;
  }
  .so-trust-bar > .so-trust-bar-item {
    padding: 18px 22px;
  }

  /* Section eyebrow + h2 spacing */
  .so-section h2 {
    font-size: clamp(1.5rem, 5.5vw, 1.875rem);
  }

  /* Prose font + spacing */
  .so-prose { font-size: 1rem; }
  .so-prose h2 {
    font-size: clamp(1.375rem, 5vw, 1.75rem);
    margin: 40px 0 12px;
  }
  .so-prose h3 { font-size: 1.1875rem; }

  /* FAQ tightening */
  .so-faq summary { font-size: 1rem; gap: 12px; }
  .so-faq p { font-size: 0.9375rem; }

  /* Sidebar — make it look right when it drops below content on mobile */
  .so-sidebar {
    position: static !important;
    top: auto !important;
    margin-top: 32px;
  }
  .so-sidebar-block { padding: 20px; }

  /* Related cluster cards → single column */
  .so-related-clusters { padding: 40px 0; }
  .so-related-card {
    padding: 22px;
    min-height: auto;
  }
  .so-related-card-title { font-size: 1.125rem; }

  /* Breadcrumbs tighter */
  .so-breadcrumbs {
    font-size: 0.8125rem;
    padding: 12px 20px;
    flex-wrap: wrap;
  }

  /* Footer: stack columns */
  .so-footer { padding: 40px 0 24px; }
  .so-footer-inner { grid-template-columns: 1fr; }
  .so-footer-col { padding-bottom: 12px; }
}

/* Tablet (601-900px) — keep two-column footer */
@media (min-width: 601px) and (max-width: 900px) {
  .so-footer-inner {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
  .so-with-sidebar {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .so-sidebar {
    position: static;
    top: auto;
  }
}

/* ============================================================
   (3) Header / mega-menu mobile collapse
   Mega-menu uses hover on desktop. On mobile we need it tap-friendly.
   ============================================================ */
@media (max-width: 900px) {
  .so-burger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
  }
  .so-burger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--n-900);
    transition: transform 0.2s, opacity 0.2s;
  }
  .so-burger[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .so-burger[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }
  .so-burger[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .so-nav {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 380px;
    height: 100vh;
    background: var(--n-0);
    padding: 80px 24px 24px;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    box-shadow: -8px 0 32px rgba(0,0,0,0.12);
    z-index: 999;
  }
  .so-nav[data-open="true"] {
    transform: translateX(0);
  }
  .so-nav-wrap {
    flex-direction: column;
    gap: 0;
  }
  .so-nav-wrap > li {
    border-bottom: 1px solid var(--n-200);
  }
  .so-nav-wrap > li > a {
    display: block;
    padding: 16px 0;
    font-size: 1.0625rem;
    font-weight: 600;
  }

  /* Mega panel inline on mobile */
  .so-mega {
    position: static !important;
    display: none;
    box-shadow: none !important;
    padding: 0 0 16px !important;
    background: transparent !important;
  }
  .so-has-mega[data-open="true"] .so-mega {
    display: block;
  }
  .so-mega-inner {
    display: block !important;
    grid-template-columns: none !important;
    padding: 0 !important;
  }
  .so-mega-col {
    padding: 10px 0;
  }
  .so-mega-heading {
    font-size: 0.75rem;
    color: var(--n-700);
    margin: 8px 0;
  }
  .so-mega-col li a {
    padding: 8px 0;
    font-size: 0.9375rem;
  }
  .so-mega-cta-btn {
    display: inline-block;
    background: #2E8B6E;
    color: var(--n-0) !important;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    margin-top: 12px;
  }

  /* Open-state backdrop */
  body[data-nav-open="true"] {
    overflow: hidden;
  }
  body[data-nav-open="true"]::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 998;
  }
}

@media (min-width: 901px) {
  .so-burger { display: none; }
}

/* ============================================================
   Menu CTA button — clean mint pill, replaces the dark slab
   ============================================================ */
.so-nav button.so-mega-cta-btn,
.so-nav a.so-mega-cta-btn,
.so-nav .so-mega-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #2E8B6E;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.9375rem;
  padding: 11px 22px;
  border-radius: 8px;
  border: none;
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(0,0,0,0.06), 0 6px 16px rgba(46,139,110,0.30);
  cursor: pointer;
  transition: background 0.15s, transform 0.12s, box-shadow 0.2s;
  letter-spacing: -0.01em;
}
.so-nav button.so-mega-cta-btn:hover,
.so-nav button.so-mega-cta-btn:focus-visible,
.so-nav a.so-mega-cta-btn:hover,
.so-nav a.so-mega-cta-btn:focus-visible {
  background: #1F6B53;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.08), 0 10px 20px rgba(46,139,110,0.40);
}
.so-nav .so-mega-cta-btn:focus-visible {
  outline: 2px solid #5FBFA0;
  outline-offset: 3px;
}

/* If the CTA is inside an <li>, kill the bullet */
.so-nav li:has(> .so-mega-cta-btn),
.so-nav li:has(> a.so-mega-cta-btn) {
  list-style: none;
}

/* Also clean up the top-level nav list — no bullets, horizontal layout */
.so-nav-wrap,
.so-nav ul {
  list-style: none !important;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 28px;
}
.so-nav-wrap > li {
  list-style: none;
}
.so-nav-wrap > li > a {
  color: #5C5347;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9375rem;
  transition: color 0.15s;
  line-height: 1.5;
}
.so-nav-wrap > li > a:hover,
.so-nav-wrap > li > a:focus-visible {
  color: #2A2520;
}

/* ============================================================
   Mega-menu dropdown positioning + visibility fix (desktop)
   ============================================================ */
@media (min-width: 901px) {
  .so-header { position: sticky; top: 0; z-index: 100; }
  .so-header-inner { position: relative; }
  .so-nav { position: static; }
  .so-nav-wrap { position: static; }

  /* The dropdown anchors to the header (the positioned ancestor) */
  .so-has-mega { position: static; }
  .so-mega {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    background: #FFFFFF;
    border-top: 1px solid #E8DCC0;
    border-bottom: 1px solid #E8DCC0;
    box-shadow: 0 16px 48px rgba(46,139,110,0.10);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    z-index: 99;
    padding: 0;
    pointer-events: none;
  }
  .so-mega-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 36px 32px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 0.9fr;
    gap: 32px;
  }

  /* Hover OR focus on the parent OR mouse over the dropdown itself */
  .so-has-mega:hover > .so-mega,
  .so-has-mega:focus-within > .so-mega,
  .so-mega:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }

  /* Bridge the gap between menu item and dropdown — prevents flicker */
  .so-has-mega::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 16px;
    pointer-events: none;
  }
  .so-has-mega:hover::after { pointer-events: auto; }

  /* Mega columns */
  .so-mega-col h3.so-mega-heading,
  .so-mega-col .so-mega-heading {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #5C5347;
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #E8DCC0;
  }
  .so-mega-col ul { list-style: none; margin: 0; padding: 0; }
  .so-mega-col li { margin: 0; padding: 0; }
  .so-mega-col li a {
    display: block;
    padding: 8px 10px;
    margin: 0 -10px;
    border-radius: 4px;
    text-decoration: none;
    color: #2A2520;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: background 0.12s, color 0.12s, transform 0.12s;
  }
  .so-mega-col li a:hover,
  .so-mega-col li a:focus-visible {
    background: #DFF3EC;
    color: #2E8B6E;
    transform: translateX(2px);
  }

  /* Featured CTA column — replace dark gradient with mint card */
  .so-mega-featured {
    background: linear-gradient(135deg, #5FBFA0 0%, #2E8B6E 100%);
    color: #ffffff;
    border-radius: 12px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
  }
  .so-mega-featured::before,
  .so-mega-featured::after { display: none; }
  .so-mega-featured h3.so-mega-heading,
  .so-mega-featured .so-mega-heading {
    color: rgba(255,255,255,0.85);
    border-bottom-color: rgba(255,255,255,0.25);
  }
  .so-mega-featured .so-mega-cta-btn,
  .so-mega-featured button.so-mega-cta-btn,
  .so-mega-featured a.so-mega-cta-btn {
    background: #ffffff;
    color: #2E8B6E;
    box-shadow: 0 1px 0 rgba(0,0,0,0.05), 0 4px 12px rgba(0,0,0,0.10);
    margin-top: auto;
    padding: 12px 18px;
    width: 100%;
    border-radius: 8px;
    font-weight: 700;
    border: none;
    cursor: pointer;
  }
  .so-mega-featured .so-mega-cta-btn:hover,
  .so-mega-featured button.so-mega-cta-btn:hover,
  .so-mega-featured a.so-mega-cta-btn:hover {
    background: #F7F1E3;
    color: #1F6B53;
    transform: translateY(-1px);
  }

  /* Down-arrow indicator on hoverable items */
  .so-has-mega > a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }
  .so-has-mega > a::after {
    content: '';
    width: 6px;
    height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translateY(-1px);
    margin-left: 4px;
    transition: transform 0.2s;
    display: inline-block;
  }
  .so-has-mega:hover > a::after,
  .so-has-mega:focus-within > a::after {
    transform: rotate(225deg) translateY(0);
  }
}

/* ============================================================
   Featured CTA column — fix the squished 4th column
   ============================================================ */
@media (min-width: 901px) {
  /* Force the featured column to occupy the 4th grid track at full width */
  .so-mega-inner {
    grid-template-columns: 1fr 1fr 1fr 220px;
    align-items: stretch;
  }
  .so-mega-inner > .so-mega-featured,
  .so-mega-col.so-mega-featured {
    grid-column: 4 / 5;
    min-width: 200px;
    width: 100%;
    box-sizing: border-box;
    align-self: stretch;
  }
  /* Button must not wrap into a vertical strip */
  .so-mega-featured .so-mega-cta-btn,
  .so-mega-featured button.so-mega-cta-btn,
  .so-mega-featured a.so-mega-cta-btn {
    white-space: nowrap;
    width: 100%;
    text-align: center;
    display: block;
    line-height: 1.2;
  }
  /* Each link column must hold its width (don't let long labels collapse them) */
  .so-mega-col {
    min-width: 0;
  }
  .so-mega-col li a {
    white-space: nowrap;
  }
}
