/* TD-AI — site-wide mobile optimizations (768px and below) */

html {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}

body {
  overflow-x: clip;
}

.page,
main {
  max-width: 100vw;
}

img,
video,
picture,
svg {
  max-width: 100%;
  height: auto;
}

main,
article,
section,
.container,
.nav-bar,
.foot {
  overflow-wrap: anywhere;
  word-wrap: break-word;
}

table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Safe area + tighter padding on phones */
@media (max-width: 768px) {
  .container,
  .nav-bar,
  header .container {
    padding-left: max(1rem, env(safe-area-inset-left)) !important;
    padding-right: max(1rem, env(safe-area-inset-right)) !important;
  }

  /* iOS: prevent focus zoom on inputs */
  input,
  textarea,
  select,
  .form input,
  .form textarea {
    font-size: 16px !important;
    max-width: 100%;
  }

  /* Nav: wrap links, no forced nowrap overflow */
  .nav,
  .nav-bar,
  header .nav {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 0.65rem !important;
  }

  .nav ul,
  .nav-links,
  header nav ul {
    width: 100%;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 0.38rem !important;
  }

  .nav a,
  .nav-links a,
  header nav a,
  .btnOutlineGold {
    white-space: normal !important;
    text-align: center;
    line-height: 1.25 !important;
    min-height: 44px;
  }

  /* Grids → single column */
  .grid,
  .grid2,
  .grid3,
  .service-grid,
  .hero-grid,
  .heroGrid,
  .hero-layout,
  .aboutGrid,
  .contactGrid,
  .offerPricingGrid,
  .monthlyGrid,
  .svcFullGrid,
  .pricing,
  .steps,
  .explorerBody {
    grid-template-columns: 1fr !important;
  }

  .explorerBody {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
  }

  .offerCol,
  .offerColSingle,
  .panel {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .heroShowcaseShell,
  .heroShowcaseStage,
  .heroOrnateFrame,
  .heroVisualCol,
  .treeLogoFrame,
  .treeLogoOverlay {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
  }

  .viz {
    min-height: 220px;
  }

  .vizCanvas {
    width: 100% !important;
    height: auto !important;
    max-height: 280px;
  }

  /* Tabs / offer toggle */
  .tabs,
  .offerToggle {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 0.45rem !important;
    width: 100%;
  }

  .tab,
  .offerToggle button,
  .offerToggle__btn {
    flex: 1 1 auto;
    min-width: min(100%, 140px);
    min-height: 44px;
  }

  /* Footer stack */
  footer .foot,
  footer .container[style*="flex"] {
    flex-direction: column !important;
    align-items: flex-start !important;
    text-align: left !important;
  }

  footer a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  /* Hero images on landing pages */
  .hero-img,
  .hero-media {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Blog / legal prose */
  main p,
  main li,
  .legal-block p,
  .legal-block li {
    font-size: clamp(0.92rem, 2.8vw, 1rem);
  }

  h1 {
    font-size: clamp(1.35rem, 5.5vw, 2rem) !important;
  }

  h2 {
    font-size: clamp(1.15rem, 4.5vw, 1.45rem) !important;
  }

  .kapcsolatH2,
  .kapcsolatH2Inner {
    font-size: clamp(1.05rem, 4.8vw, 1.45rem) !important;
    line-height: 1.28 !important;
  }

  /* CTA rows full width buttons */
  .cta-row .btn,
  .cta-row .btnPrimary,
  .cta-row .btnGhost,
  .cta .btn,
  .aboutCtaRow .btnOutlineGold,
  .heroCtas .btn {
    width: 100%;
    justify-content: center;
  }

  .footLegal {
    min-width: 0 !important;
  }

  .footLinks {
    align-items: flex-start !important;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .container,
  header .container {
    padding-left: max(0.75rem, env(safe-area-inset-left)) !important;
    padding-right: max(0.75rem, env(safe-area-inset-right)) !important;
  }

  .svcMobCard {
    padding: 0.75rem 0.85rem;
    gap: 0.6rem;
  }

  .svcMobCard__body strong {
    font-size: 0.92rem;
  }
}

/* ===== Services: mobile card list (replaces horizontal image scroll) ===== */

.servicesMobileCards {
  display: none;
  grid-template-columns: 1fr;
  gap: 0.65rem;
  margin-top: 0.35rem;
}

.svcMobCard {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem;
  min-height: 56px;
  border-radius: 14px;
  border: 1px solid rgba(197, 160, 89, 0.38);
  background: linear-gradient(145deg, rgba(219, 177, 85, 0.1), rgba(0, 0, 0, 0.42));
  color: #f8f0de;
  text-decoration: none;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.svcMobCard:active,
.svcMobCard:focus-visible {
  border-color: rgba(240, 212, 155, 0.85);
  transform: scale(0.99);
  outline: none;
  box-shadow: 0 0 28px rgba(197, 160, 89, 0.22);
}

.svcMobCard__icon {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  border: 1px solid rgba(219, 177, 85, 0.45);
  background: rgba(0, 0, 0, 0.35);
  font-size: 1.15rem;
  flex-shrink: 0;
}

.svcMobCard__body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.svcMobCard__body strong {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 0.98rem;
  line-height: 1.2;
  color: #fffaf3;
}

.svcMobCard__body span {
  font-size: 0.8rem;
  line-height: 1.35;
  color: rgba(237, 232, 222, 0.78);
}

.svcMobCard__arrow {
  font-size: 1.1rem;
  color: rgba(219, 177, 85, 0.85);
  flex-shrink: 0;
}

.svcMobCard--cta {
  border-color: rgba(240, 212, 155, 0.55);
  background: linear-gradient(135deg, rgba(219, 177, 85, 0.28), rgba(0, 0, 0, 0.35));
  margin-top: 0.25rem;
}

.svcMobCard--cta .svcMobCard__body strong {
  color: #f5dfaa;
}

@media (max-width: 768px) {
  /* Hide desktop image-map scroller on phones — card grid replaces it */
  .servicesClickHint,
  .services-click-hint,
  .servicesImageScroller,
  .hero-scroller {
    display: none !important;
  }

  .servicesMobileHint,
  .services-mobile-hint {
    display: block !important;
    margin: 0.15rem 0 0.55rem !important;
    font-size: 0.88rem !important;
    line-height: 1.42 !important;
    font-weight: 600 !important;
    color: rgba(237, 232, 222, 0.9) !important;
  }

  .servicesImageSection .servicesCardGrid,
  .services-visual-wrap .servicesCardGrid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 0.65rem !important;
  }

  .services-visual-wrap .servicesMobileCards {
    display: grid !important;
  }

  .servicesMobileCards {
    display: none !important;
  }

  /* Mobile section order: hero → szolgáltatások → rólam */
  main#top {
    display: flex;
    flex-direction: column;
  }

  main#top > .hero {
    order: 1;
  }

  main#top > .servicesImageSection {
    order: 2;
  }

  main#top > .aboutSection {
    order: 3;
    padding-top: 0.75rem !important;
    padding-bottom: 1.25rem !important;
  }

  main#top > .aboutSection .aboutGrid {
    margin-top: 0.85rem;
  }

  main#top > .aboutSection .aboutPortrait {
    min-height: 220px;
  }

  main#top > .aboutSection .aboutPortrait__frame {
    width: min(68%, 220px);
  }

  main#top > .section--explorer,
  main#top > #rendszer {
    display: none !important;
  }

  main#top > .section:not(.hero):not(.servicesImageSection):not(.aboutSection):not(.section--explorer) {
    order: 10;
  }

  main#top > .aiChatPanel {
    order: 99;
  }

  .servicesImageSection,
  .services-visual-wrap .hero {
    padding-top: 0.5rem !important;
    padding-bottom: 0.75rem !important;
  }

  .servicesImageIntro,
  .services-guide {
    text-align: left !important;
    margin-bottom: 0.65rem !important;
  }

  .servicesImageIntro h2,
  .services-guide h1 {
    font-size: 1.25rem !important;
    line-height: 1.25 !important;
  }
}

@media (min-width: 769px) {
  .servicesImageSection .servicesCardGrid,
  .services-visual-wrap .servicesCardGrid,
  .services-visual-wrap .servicesMobileCards {
    display: none !important;
  }

  .servicesClickHint,
  .services-click-hint {
    display: flex !important;
  }
}
