/**
 * ImperoHosting — phone/tablet layer (loaded after portal.css)
 */
html:has(.ih-header),
body:has(.ih-header),
.ih-portal-app,
.ih-control,
.ih-acquire,
.ih-privacy,
.ih-main,
.ih-hero,
.ih-section,
.ih-site,
.ih-content {
  max-width: 100%;
  overflow-x: clip;
}

html.ih-header-nav-lock,
html.ih-header-nav-lock body {
  overflow: hidden !important;
}

/* Marketing header hamburger (desktop: hidden) */
.ih-header-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  margin-left: auto;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: color-mix(in srgb, #fff 8%, transparent);
  cursor: pointer;
  z-index: 420;
}
.ih-header-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: #f8fafc;
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.ih-header.is-nav-open .ih-header-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.ih-header.is-nav-open .ih-header-toggle span:nth-child(2) {
  opacity: 0;
}
.ih-header.is-nav-open .ih-header-toggle span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}
.ih-header-scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 410;
  border: 0;
  padding: 0;
  background: rgba(2, 6, 23, 0.55);
  cursor: pointer;
}

html.ih-nav-lock,
html.ih-nav-lock body {
  overflow: hidden !important;
}

.ih-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 12px;
  border: 1px solid var(--ih-border, rgba(255,255,255,.14));
  background: color-mix(in srgb, var(--nf-header, #0345bf) 22%, transparent);
  color: #f8fafc;
  cursor: pointer;
  flex-shrink: 0;
}

.ih-nav-scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 70;
  border: 0;
  background: rgba(2, 6, 23, 0.55);
  cursor: pointer;
}

.ih-control__mobile-bar {
  display: none;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem max(0.75rem, env(safe-area-inset-right)) 0.55rem max(0.75rem, env(safe-area-inset-left));
  border-bottom: 1px solid var(--ih-border, rgba(255,255,255,.12));
  background: color-mix(in srgb, #0f172a 94%, transparent);
  position: sticky;
  top: 0;
  z-index: 40;
  flex: 0 0 auto;
}

.ih-control__mobile-bar strong {
  font-size: 0.95rem;
  color: #f8fafc;
}

/* Home / marketing: readable on light or dark shells */
@media (max-width: 980px) {
  /* Sticky marketing header → logo + hamburger; links in drawer */
  .ih-header-inner {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.75rem !important;
    min-height: 56px;
    padding-block: 0.35rem !important;
    width: 100%;
    max-width: 100%;
  }
  .ih-header-toggle {
    display: inline-flex !important;
  }
  .ih-header .ih-nav,
  .ih-header--sticky .ih-nav {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    width: min(88vw, 320px) !important;
    max-width: 320px !important;
    height: 100dvh !important;
    margin: 0 !important;
    padding: calc(4.5rem + env(safe-area-inset-top, 0px)) 1rem max(1rem, env(safe-area-inset-bottom)) !important;
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    gap: 0.35rem !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    background: #0b1220 !important;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    transform: translateX(105%);
    transition: transform 0.22s ease;
    z-index: 415;
  }
  .ih-header.is-nav-open .ih-nav {
    transform: translateX(0);
  }
  .ih-header.is-nav-open .ih-header-scrim {
    display: block;
  }
  .ih-header .ih-nav-link,
  .ih-header .ih-nav-cta {
    width: 100%;
    justify-content: flex-start;
    min-height: 44px;
    padding: 0.7rem 0.9rem !important;
    border-radius: 12px !important;
    white-space: normal !important;
    text-align: left;
  }
  .ih-nav--embedded .ih-nav-embedded-inner {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.35rem;
    padding-bottom: 0.15rem;
    max-width: 100%;
  }

  .ih-hero,
  .ih-hero-copy,
  .ih-section {
    padding-inline: max(0.85rem, env(safe-area-inset-left)) max(0.85rem, env(safe-area-inset-right));
  }

  .ih-hero-grid,
  .ih-portal-hero__grid,
  .ih-hero-grid[class],
  .ih-split,
  .ih-feature-grid,
  .ih-stat-grid,
  .ih-hero-stats {
    grid-template-columns: 1fr !important;
  }

  .ih-hero-copy h1,
  .ih-hero h1,
  .ih-section-title,
  .ih-hero-lead,
  .ih-section-lead,
  .ih-eyebrow {
    color: var(--ih-heading, #0f172a) !important;
    -webkit-text-fill-color: currentColor !important;
  }

  body.ih-zas-bg .ih-hero-copy h1,
  body.ih-zas-bg .ih-hero h1,
  body.ih-zas-bg .ih-section-title,
  body.ih-zas-bg .ih-hero-lead,
  body.ih-zas-bg .ih-section-lead,
  body.ih-app-fullscreen .ih-hero-copy h1,
  html.ih-zas-bg .ih-hero-copy h1 {
    color: #f8fafc !important;
    -webkit-text-fill-color: #f8fafc !important;
  }

  body.ih-zas-bg .ih-hero-lead,
  body.ih-zas-bg .ih-section-lead,
  body.ih-zas-bg .ih-eyebrow {
    color: #cbd5e1 !important;
    -webkit-text-fill-color: #cbd5e1 !important;
  }

  .ih-stat {
    background: color-mix(in srgb, #0f172a 8%, transparent);
    border: 1px solid color-mix(in srgb, #0f172a 12%, transparent);
    border-radius: 12px;
    padding: 0.65rem 0.75rem;
  }
  .ih-stat strong,
  .ih-stat span {
    color: var(--ih-heading, #0f172a) !important;
    -webkit-text-fill-color: currentColor !important;
  }
  body.ih-zas-bg .ih-stat {
    background: color-mix(in srgb, #fff 8%, transparent);
    border-color: color-mix(in srgb, #fff 14%, transparent);
  }
  body.ih-zas-bg .ih-stat strong,
  body.ih-zas-bg .ih-stat span {
    color: #f8fafc !important;
  }

  .ih-hero-actions,
  .ih-portal-actions {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }
  .ih-hero-actions .ih-btn,
  .ih-portal-actions .ih-btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .ih-domain-search__row {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .ih-domain-search__input,
  .ih-domain-search__btn {
    width: 100%;
    min-height: 48px;
    font-size: 16px !important;
  }

  .ih-hero-visual {
    max-width: 100%;
    margin-inline: auto;
  }
  .ih-hero-visual img,
  .ih-hero-visual svg {
    max-width: 100%;
    height: auto;
  }

  /* Control plane: flex shell + off-canvas nav (no reserved grid track) */
  .ih-control,
  .ih-control--fullscreen {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 100dvh;
  }

  .ih-control__mobile-bar {
    display: flex;
  }
  .ih-nav-toggle {
    display: inline-flex;
  }

  .ih-control__layout,
  .ih-control__layout--fullscreen {
    display: block !important;
    grid-template-columns: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 0.65rem max(0.75rem, env(safe-area-inset-right)) 1rem max(0.75rem, env(safe-area-inset-left)) !important;
    overflow: visible !important;
  }

  .ih-control__nav,
  .ih-control__nav--compact,
  .ih-control__nav--sticky,
  .ih-control__layout--fullscreen .ih-control__nav--compact {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: min(90vw, 340px) !important;
    max-width: 340px !important;
    max-height: none !important;
    height: 100dvh !important;
    margin: 0 !important;
    z-index: 80 !important;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: max(0.85rem, env(safe-area-inset-top)) 0.85rem max(1rem, env(safe-area-inset-bottom)) !important;
    background: #0b1220 !important;
    align-self: auto !important;
  }

  .ih-control.is-nav-open .ih-control__nav {
    transform: translateX(0);
  }

  .ih-control.is-nav-open .ih-nav-scrim {
    display: block;
  }

  .ih-control__main {
    display: block !important;
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .ih-portal-hero__grid,
  .ih-hero-grid,
  .ih-two-col,
  .ih-portal-gate,
  .ih-builder__workspace,
  .ih-builder__workspace[data-layout],
  .ih-acquire-layout,
  .ih-acquire-hero__grid {
    grid-template-columns: 1fr !important;
  }

  .ih-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .ih-assistente {
    width: 100% !important;
    max-width: 100% !important;
  }

  .ih-assistente__panel {
    width: min(100vw, 100%) !important;
    max-width: 100% !important;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0 !important;
  }

  .ih-table-wrap,
  .ih-domain-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table.ih-table,
  .ih-table {
    min-width: 0 !important;
  }

  .ih-btn,
  .ih-control__link,
  .ih-field input,
  .ih-field select,
  .form-control,
  .form-select {
    min-height: 44px;
  }

  .ih-dl > div {
    grid-template-columns: 1fr !important;
  }

  /* Cookie / CMP must not permanently cover CTAs */
  .ih-main,
  .ih-portal-app,
  .ih-control__main {
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  }
}

@media (max-width: 560px) {
  .ih-kpi-grid {
    grid-template-columns: 1fr !important;
  }

  .ih-mode-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .ih-field input,
  .ih-field select,
  .form-control,
  .form-select,
  textarea {
    font-size: 16px !important;
  }

  .ih-container,
  .ih-container--fluid {
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
  }

  .nf-pb__steps,
  .nf-pb__palette {
    grid-template-columns: 1fr !important;
  }

  .ih-plans-grid,
  .ih-pricing-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-height: 480px) and (orientation: landscape) {
  .ih-control__nav {
    width: min(72vw, 300px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ih-control__nav {
    transition: none;
  }
}
