/*
 * Gman Realty responsive consistency layer
 * Loaded last so phones and browser mobile emulation use the same layout rules.
 */

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

body {
  width: 100%;
  min-width: 320px;
  overflow-x: clip;
}

img,
picture,
video,
canvas,
svg,
iframe {
  max-width: 100%;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

@supports (padding: max(0px)) {
  .site-header {
    padding-top: env(safe-area-inset-top);
  }

  .site-nav {
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }

  .site-footer {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .back-to-top {
    bottom: max(14px, env(safe-area-inset-bottom));
  }
}

/* Use one navigation breakpoint in CSS and JavaScript. */
@media (max-width: 1040px) {
  .site-header {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .menu-toggle {
    position: relative;
    z-index: 121;
    display: block;
    flex: 0 0 46px;
  }

  .site-nav {
    position: fixed;
    top: calc(76px + env(safe-area-inset-top, 0px));
    right: 0;
    bottom: 0;
    left: auto;
    z-index: 120;
    width: min(360px, 92vw);
    max-width: none;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    align-content: flex-start;
    gap: 7px;
    padding: 24px 20px max(28px, env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
    box-shadow: -18px 20px 45px rgba(7, 26, 51, 0.2);
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateX(105%);
    transition: transform 0.24s ease, opacity 0.2s ease, visibility 0s linear 0.24s;
  }

  .site-nav.open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
    transition-delay: 0s;
  }

  .site-nav .nav-link,
  .site-nav .nav-button {
    width: 100%;
    min-height: 48px;
    margin: 0;
    justify-content: flex-start;
    padding: 12px 14px;
    border-radius: 10px;
  }

  .site-nav .nav-link.nav-cta,
  .site-nav .nav-link.nav-account {
    justify-content: center;
  }
}

/* Unified phone/mobile layout: 320px through 767px. */
@media (max-width: 767px) {
  :root {
    --mobile-gutter: 16px;
    --mobile-header-height: 68px;
  }

  .container {
    width: calc(100% - (var(--mobile-gutter) * 2));
    max-width: none;
  }

  .site-header {
    width: 100%;
  }

  .header-inner {
    min-height: var(--mobile-header-height);
    gap: 12px;
  }

  .brand {
    min-width: 0;
    max-width: calc(100% - 58px);
  }

  .brand img {
    width: 152px;
    max-width: 100%;
    height: 43px;
  }

  .menu-toggle {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
    border-radius: 10px;
  }

  .site-nav {
    top: calc(var(--mobile-header-height) + env(safe-area-inset-top, 0px));
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: none;
    gap: 7px;
    padding: 18px var(--mobile-gutter) max(24px, env(safe-area-inset-bottom, 0px));
    box-shadow: none;
    transform: translateX(100%);
  }

  .site-nav.open {
    transform: translateX(0);
  }

  .nav-link,
  .nav-link.nav-admin,
  .nav-link.nav-cta,
  .nav-button {
    width: 100%;
    min-height: 48px;
    margin: 0;
    justify-content: flex-start;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 15px;
  }

  .nav-link.nav-cta {
    justify-content: center;
    margin-top: 5px;
  }

  .nav-link.nav-admin {
    min-height: 44px;
    font-size: 14px;
  }

  .hero {
    min-height: auto;
    background-position: center;
  }

  .hero-content {
    max-width: none;
    padding: 62px 0 58px;
  }

  .hero h1 {
    max-width: 100%;
    margin-bottom: 16px;
    font-size: clamp(36px, 10.6vw, 50px);
    line-height: 1.08;
    letter-spacing: -0.04em;
    text-wrap: balance;
  }

  .hero-copy {
    max-width: 100%;
    margin-bottom: 24px;
    font-size: 16px;
    line-height: 1.65;
  }

  .search-panel {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
    padding: 10px;
    border-radius: 14px;
  }

  .search-panel input:first-child {
    grid-column: auto;
  }

  .search-panel input,
  .search-panel select,
  .search-panel .btn,
  .form-group input,
  .form-group select,
  .form-group textarea,
  .form-control {
    min-width: 0;
    font-size: 16px;
  }

  .search-panel .btn {
    width: 100%;
  }

  .hero-chips {
    gap: 8px;
    margin-top: 16px;
  }

  .hero-chip {
    padding: 7px 10px;
    font-size: 12px;
  }

  .section,
  .section-sm {
    padding: 54px 0;
  }

  .page-hero {
    padding: 52px 0;
  }

  .page-hero h1 {
    font-size: clamp(34px, 9.5vw, 46px);
  }

  .page-hero p {
    font-size: 16px;
  }

  .breadcrumbs {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .section-heading,
  .results-toolbar,
  .details-heading,
  .footer-bottom,
  .admin-intro {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
  }

  .section-heading {
    gap: 12px;
    margin-bottom: 24px;
  }

  .section-title {
    font-size: clamp(28px, 8.5vw, 38px);
  }

  .section-copy {
    line-height: 1.65;
  }

  .section-link {
    padding-top: 0;
  }

  .category-grid,
  .property-grid,
  .feature-grid,
  .value-grid,
  .team-grid,
  .footer-main,
  .listings-layout,
  .details-shell,
  .contact-grid,
  .about-grid,
  .form-grid,
  .summary-list,
  .filter-pair,
  .checkbox-grid,
  .image-preview-grid,
  .admin-stats {
    grid-template-columns: minmax(0, 1fr);
  }

  .category-grid,
  .property-grid,
  .feature-grid,
  .value-grid,
  .team-grid {
    gap: 16px;
  }

  .category-card {
    min-height: 124px;
    grid-template-columns: 56px minmax(0, 1fr);
    grid-template-rows: auto auto;
    place-items: initial;
    align-items: center;
    justify-items: start;
    column-gap: 14px;
    padding: 20px;
    text-align: left;
  }

  .category-card .category-icon {
    grid-row: 1 / 3;
    width: 54px;
    height: 54px;
    margin: 0;
  }

  .category-card strong {
    align-self: end;
  }

  .category-card small {
    align-self: start;
  }

  .property-card,
  .category-card,
  .value-card,
  .team-card {
    transform: none !important;
  }

  .property-card-image {
    aspect-ratio: 16 / 10;
  }

  .property-card-body,
  .details-content {
    padding: 20px;
  }

  .property-card-title {
    font-size: 18px;
  }

  .property-price {
    font-size: 21px;
  }

  .property-meta {
    gap: 9px 12px;
  }

  .feature-card,
  .value-card,
  .team-card,
  .contact-card {
    padding: 22px;
  }

  .cta-band {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 32px 22px;
    text-align: left;
  }

  .cta-band .btn {
    width: 100%;
  }

  .filter-toggle {
    display: inline-flex;
  }

  .filter-panel {
    position: static;
    display: none;
    max-height: none;
    margin-bottom: 18px;
    overflow: visible;
    padding: 20px;
  }

  .filter-panel.open {
    display: block;
  }

  .results-toolbar {
    width: 100%;
    gap: 12px;
    padding: 14px;
  }

  .results-toolbar label,
  .results-toolbar select {
    width: 100%;
  }

  .results-toolbar select {
    min-width: 0;
  }

  .details-shell {
    gap: 20px;
  }

  .details-sidebar {
    position: static;
    grid-row: auto;
  }

  .details-gallery {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
    padding: 7px;
  }

  .details-main-image {
    min-height: 0;
    aspect-ratio: 16 / 10;
  }

  .details-thumbs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
    gap: 7px;
  }

  .details-thumbs img,
  .details-thumbs .image-placeholder {
    aspect-ratio: 4 / 3;
    min-height: 0;
  }

  .details-heading {
    gap: 10px;
  }

  .details-heading h1 {
    font-size: clamp(28px, 8.5vw, 38px);
  }

  .details-price {
    width: fit-content;
    font-size: 23px;
  }

  .details-stats,
  .amenities-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .details-sidebar-card,
  .location-card {
    padding: 22px;
  }

  .action-stack .btn {
    width: 100%;
  }

  .form-shell {
    width: 100%;
  }

  .form-card,
  .policy-card,
  .setup-card,
  .summary-card {
    width: 100%;
    padding: 22px 18px;
  }

  .span-2 {
    grid-column: auto;
  }

  .stepper {
    width: 100%;
    grid-template-columns: repeat(5, minmax(90px, 1fr));
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    padding: 2px 2px 9px;
  }

  .stepper-item {
    scroll-snap-align: start;
  }

  .form-navigation {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .form-navigation > div {
    display: grid;
    gap: 9px;
    width: 100%;
  }

  .form-navigation .btn,
  .form-navigation > div .btn {
    width: 100%;
  }

  .image-preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .contact-image,
  .about-image,
  .contact-image img,
  .about-image img {
    min-height: 250px;
  }

  .contact-card {
    align-items: flex-start;
  }

  .policy-card {
    overflow-wrap: anywhere;
  }

  .footer-main {
    gap: 28px;
    padding: 48px 0 30px;
  }

  .footer-brand,
  .footer-brand p {
    max-width: 100%;
  }

  .footer-brand {
    text-align: center;
  }

  .footer-brand > a.has-image {
    margin-inline: auto;
  }

  .footer-brand > a.has-image img {
    width: min(220px, 72vw);
    height: auto;
  }

  .footer-bottom {
    gap: 8px;
    padding: 20px 0;
  }

  .auth-section {
    min-height: calc(100svh - var(--mobile-header-height));
    padding: 36px 0;
  }

  .auth-shell {
    grid-template-columns: minmax(0, 1fr);
    overflow: hidden;
    border-radius: 18px;
  }

  .auth-aside,
  .auth-card {
    padding: 28px 20px;
  }

  .auth-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .auth-tab {
    min-width: 0;
    min-height: 43px;
    padding: 8px 5px;
    font-size: 12px;
  }

  .phone-input-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .phone-otp-actions,
  .phone-verification-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .otp-input {
    letter-spacing: 0.32em;
  }

  .admin-shell {
    padding: 28px 0 54px;
  }

  .admin-login-wrap,
  .admin-denied-wrap {
    width: 100%;
    margin: 18px auto;
  }

  .admin-login-wrap .auth-card,
  .admin-denied-wrap {
    padding: 24px 18px;
  }

  .admin-property-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 14px;
  }

  .admin-property-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .admin-tabs {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    padding-bottom: 12px;
  }

  .admin-tab {
    flex: 0 0 auto;
  }

  .admin-property-actions,
  .admin-verify-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }

  .admin-property-actions .btn,
  .admin-verify-actions .btn {
    width: 100%;
  }

  .empty-state,
  .not-found-state {
    padding: 42px 18px;
  }

  .toast {
    right: var(--mobile-gutter);
    left: var(--mobile-gutter);
    bottom: max(70px, calc(env(safe-area-inset-bottom, 0px) + 62px));
    width: auto;
    max-width: none;
  }

  .back-to-top {
    right: var(--mobile-gutter);
  }
}

/* Only fine-tune spacing on very narrow phones; do not change the layout. */
@media (max-width: 380px) {
  :root {
    --mobile-gutter: 13px;
  }

  .brand img {
    width: 142px;
  }

  .hero h1 {
    font-size: 35px;
  }

  .auth-aside,
  .auth-card,
  .form-card,
  .policy-card,
  .setup-card,
  .summary-card {
    padding-right: 16px;
    padding-left: 16px;
  }

  .details-stats,
  .amenities-grid,
  .image-preview-grid {
    gap: 8px;
  }
}

@media (max-width: 767px) and (orientation: landscape) {
  .hero-content {
    padding: 44px 0;
  }

  .site-nav {
    overflow-y: auto;
  }
}

@media (max-width: 767px) {
  h1,
  h2,
  h3,
  h4,
  p,
  a,
  span,
  strong,
  small,
  .footer-links,
  .admin-property-contact {
    overflow-wrap: anywhere;
  }

  button,
  .btn,
  .nav-link,
  input,
  select,
  textarea {
    touch-action: manipulation;
  }
}


@media (max-width: 900px) {
  .nav-link.nav-account {
    width: 100%;
    min-height: 48px;
    margin: 5px 0 0;
    justify-content: center;
    padding: 12px 14px;
    font-size: 15px;
  }
  .hero.has-image {
    background-image:
      linear-gradient(90deg, rgba(4, 19, 40, .92) 0%, rgba(4, 19, 40, .78) 58%, rgba(4, 19, 40, .48) 100%),
      var(--site-image);
    background-position: 64% center;
  }
}

@media (max-width: 480px) {
  .hero.has-image { background-position: 67% center; }
}
