/* Mobile-first compatibility layer for the legacy inline pages. */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: clip; }
body { min-width: 0; overflow-x: clip; }
img, svg { max-width: 100%; }
button, input, select { font: inherit; }
a, button, input, select { touch-action: manipulation; }
:focus-visible { outline: 3px solid rgba(0, 230, 118, .82); outline-offset: 3px; }

/* Normalize the two footer structures used by the legacy pages. */
.footer-middle {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(18px, 3vw, 36px);
  min-width: 0;
}
.footer-right {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
}
.footer-block {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(0, 230, 118, .13);
  border-radius: 12px;
  background: rgba(0, 230, 118, .025);
}
.footer-block h4 { margin: 0 0 7px; font-size: 13px; }
.footer-block p { margin: 0; color: #83a387; font-size: 11px; line-height: 1.65; }

.mobile-menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid rgba(0, 230, 118, .22);
  border-radius: 10px;
  background: rgba(0, 230, 118, .06);
  color: #e8f5e9;
  cursor: pointer;
}
.mobile-menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  margin: 3px auto;
  border-radius: 2px;
  background: currentColor;
  transition: transform .2s ease, opacity .2s ease;
}
.mobile-menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.mobile-menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.mobile-menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

@media (max-width: 768px) {
  .navbar { padding: 0 16px !important; }
  .nav-container { height: 64px !important; position: relative; gap: 8px; }
  .nav-left { min-width: 0; }
  .logo-icon { width: 40px !important; height: 40px !important; flex: 0 0 auto; }
  .logo-text { min-width: 0; }
  .logo-title { white-space: nowrap; }
  .logo-sub { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-right { display: none !important; }
  .mobile-menu-toggle { display: grid; place-content: center; margin-left: auto; flex: 0 0 auto; }
  .nav-links {
    display: none !important;
    position: absolute;
    z-index: 300;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px !important;
    padding: 10px;
    border: 1px solid rgba(0, 230, 118, .2);
    border-radius: 14px;
    background: rgba(5, 14, 8, .98);
    box-shadow: 0 22px 52px rgba(0, 0, 0, .58);
  }
  .nav-links.is-open { display: grid !important; }
  .nav-link {
    min-height: 44px;
    padding: 11px 12px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
  }
  .main { width: 100%; margin: 42px auto 56px !important; padding: 0 16px !important; }
  .main > h1 { margin: 0 0 10px; font-size: clamp(28px, 9vw, 38px); line-height: 1.2; }
  .main > p { margin: 0 0 28px; font-size: 16px; line-height: 1.7; }
  .section { margin-top: 34px; }
  .section-header { gap: 10px; align-items: flex-start; }
  .section-title { font-size: 18px; line-height: 1.45; }
  .tag { display: inline-flex; margin-top: 4px; }
  .footer { padding: 34px 16px 20px !important; }
  .footer-inner { width: 100% !important; min-width: 0; grid-template-columns: minmax(0, 1fr) !important; gap: 20px !important; }
  .footer-inner > * { min-width: 0; max-width: 100%; }
  .footer-left,
  .footer-middle,
  .footer-right,
  .footer-social,
  .social-icons { width: 100%; min-width: 0; }
  .footer-inner:has(> .footer-col) {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    column-gap: 12px !important;
    row-gap: 20px !important;
  }
  .footer-inner:has(> .footer-col) > .footer-left,
  .footer-inner:has(> .footer-col) > .footer-social-block { grid-column: 1 / -1; }
  .footer-middle {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }
  .footer-right { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .footer-block { padding: 12px; }
  .footer-col { min-width: 0; }
  .footer-col h4,
  .footer-social-title { margin: 0 0 8px !important; font-size: 14px !important; }
  .footer-col a {
    min-width: 0;
    min-height: 38px;
    margin: 0 !important;
    padding: 8px 0;
    display: flex !important;
    align-items: center;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-size: 12px !important;
    line-height: 1.35;
  }
  .footer-social { gap: 8px !important; }
  .social-icons { gap: 8px !important; }
  .social-icons a { width: 44px; height: 44px; display: grid; place-items: center; }
  .social-names { display: none !important; }
  .social-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .social-item { min-height: 44px; padding: 8px 10px !important; }
  .footer-secondary { margin-top: 24px !important; padding-top: 16px !important; gap: 10px !important; }
  .footer-meta { font-size: 11px !important; }
  .footer-bottom { margin-top: 22px !important; padding-top: 16px !important; font-size: 11px !important; }
  .footer-powered-logo { width: 32px !important; height: 32px !important; }
  .footer-secondary, .footer-bottom { align-items: flex-start !important; text-align: left !important; }
  .footer-desc { max-width: none !important; }
}

@media (max-width: 380px) {
  .logo-sub { display: none; }
  .nav-links { grid-template-columns: 1fr; max-height: calc(100dvh - 88px); overflow-y: auto; }
  .footer { padding-inline: 12px !important; }
  .footer-inner:has(> .footer-col),
  .footer-middle { column-gap: 9px !important; }
  .footer-col h4 { font-size: 13px !important; }
  .footer-col a { font-size: 11px !important; }
  .footer-right { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
