/*
 * Responsive additions only. Nothing here applies at desktop widths; the
 * template stylesheets define the desktop layout and are left unchanged.
 * Inline grid styles from the templates are overridden with !important
 * because inline declarations cannot be reached any other way.
 */

/* ---------- grids: collapse columns as the viewport narrows ---------- */
@media (max-width: 1100px) {
  .rg-7 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .rg-6 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .rg-5 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .rg-4 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .rg-3 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .side .menu a { padding-left: 30px; padding-right: 30px; }
  .side .top { padding: 0 30px; }
}

@media (max-width: 768px) {
  .rg-7 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .rg-6 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .rg-2 { grid-template-columns: 1fr !important; }
  .fh img { max-width: 100%; }
  .hero-txt { padding: 90px 16px 70px !important; }
  .hero-txt h1 { padding-right: 0 !important; }
  .hero-txt h1 > span[aria-hidden] { display: none; }
  .fpad { padding-left: 0 !important; padding-right: 0 !important; }
  .fmedia { margin-left: 0 !important; margin-right: 0 !important; }
  .sidebar { max-width: none !important; }
  .main-col { flex-basis: 100% !important; }
  .gallery-main { height: auto !important; aspect-ratio: 16 / 10; }
  .video-box, .map-box { height: auto !important; aspect-ratio: 16 / 9; }
  .pg { flex-wrap: wrap; }
  .pg a { border-bottom: 1px solid #dfe3ea; }
  .rv { flex-wrap: wrap; }
  .rv-imgs { flex-wrap: wrap; }
  .dash-main { padding-left: 16px !important; padding-right: 16px !important; }
  .topbar { padding-left: 16px; padding-right: 16px; height: auto; min-height: 100px; padding-top: 12px; padding-bottom: 12px; }
  .card.pay-sum { margin-left: 0 !important; margin-right: 0 !important; }
}

@media (max-width: 640px) {
  .rg-7, .rg-6, .rg-5, .rg-4, .rg-3 { grid-template-columns: 1fr !important; }
  .rg-5.thumbs { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .city { flex-direction: column; }
  .city img { width: 100%; height: 200px; }
  .aphoto { flex: 1 1 100% !important; }
  .counter-band { margin-left: 0 !important; margin-right: 0 !important; }
  .testi { padding: 40px 24px 36px; }
  .acard .co { flex-wrap: wrap; gap: 12px; }
  .tour-row { flex-wrap: wrap; }
  .about-media { height: 260px !important; }
  .side .me { padding: 32px 16px 40px; }
}

@media (max-width: 420px) {
  .hdr { padding-left: 16px; padding-right: 16px; }
  .nav { gap: 18px 24px; }
  .hright { gap: 14px; }
  .fld { padding-left: 16px; padding-right: 16px; }
  .tab { min-width: 0; flex: 1 1 140px; }
  .wrap { padding-left: 12px; padding-right: 12px; }
  .card, .scard { padding-left: 16px; padding-right: 16px; }
  .section-pad { padding-left: 16px !important; padding-right: 16px !important; }
}

/* ---------- tap targets: at least 44px on touch widths ---------- */
@media (max-width: 768px) {
  .nav a, .topbar nav a, .hright a, .crumb a { min-height: 44px; display: inline-flex; align-items: center; }
  .tools button { width: 44px; height: 44px; }
  .pfoot .acts button, .plist .pfoot .acts button { padding: 12px; margin: -12px; }
  .fld input, .fld select.fldsel { min-height: 44px; }
  .tap { display: inline-flex; align-items: center; min-height: 44px; }
  .lnk-red { min-width: 44px; padding: 0 6px; }
  .pay .sum a, .dash-main .sum a { display: inline-flex; align-items: center; min-height: 44px; margin: -12px 0; }
  .pfoot .acts { gap: 26px; }
  .soc a { width: 44px; height: 44px; }
  .cnt button { padding: 7px; margin: -7px; }
  .msg .acts button, .row .acts button { padding: 14px; margin: -14px; }
  .row .acts a.e { padding: 12px 0; }
  .tags a { min-height: 44px; display: inline-flex; align-items: center; }
  .cat li { min-height: 44px; }
  .foot .navcols li { padding: 0; }
  .foot .navcols a { display: block; padding: 14px 0; }
  .copy .socs a { padding: 14px; margin: -14px; display: inline-flex; }
  .stars.rate label { padding: 10px; margin: -10px; }
  .gallery-nav { width: 44px !important; height: 44px !important; margin-top: -22px !important; }
  .map-zoom button { width: 44px !important; height: 44px !important; }
  .chk { min-height: 44px; }
  .pay .inp { min-height: 44px; }
  .view-toggle button { width: 44px !important; height: 44px !important; }
  .slide-nav button { padding: 11px; margin: -11px; }
  .recent, .bs { min-height: 44px; }
  .pg a { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .sortsel { min-height: 44px; }
}

/* ---------- motion: keep interaction feedback short, respect user setting ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ---------- fixes from the 360px audit ---------- */
@media (max-width: 768px) {
  .hero-txt form .fld { flex: 1 1 100% !important; }
  .hero-txt form .btn-red { width: 100%; }
  .resbar-right { flex-wrap: wrap; justify-content: flex-start; row-gap: 12px; }
  .pbody h3 a, .pbody h4 a, .acard h4 a, .agent h4 a, .recent h5, .bs h5 { display: inline-block; padding: 10px 0; margin: -10px 0; }
  .acard .co a, a[data-toggle], .adv label { display: inline-flex; align-items: center; min-height: 44px; }
  .adv label { margin-bottom: 4px; }
  .pg a { min-width: 44px; }
  .view-toggle a, .view-toggle button { width: 44px !important; height: 44px !important; }
  .cnt button { width: 44px; height: 44px; padding: 0; margin: -7px; }
  .sidebar form input[style*="height:40px"], .sidebar form .btn-red[style*="height:40px"] { height: 44px !important; min-height: 44px !important; }
  .cat li a { display: inline-flex; align-items: center; min-height: 44px; }
}
@media (max-width: 768px) {
  .hero-txt nav a { display: inline-flex; align-items: center; min-height: 44px; }
  .prod h4 a, .team h4 { display: inline-block; padding: 10px 0; margin: -10px 0; }
  .cat li a { min-width: 44px; }
  .card > p a { display: inline-block; padding: 13px 0; margin: -13px 0; }
}
@media (max-width: 768px) {
  td a { display: inline-flex; align-items: center; justify-content: center; padding: 13px 15px; margin: -13px -15px; }
  .msg .acts a { padding: 14px; margin: -14px; }
  .row .acts a.e { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0; }
  .row h4 a { display: inline-block; padding: 12px 0; margin: -12px 0; }
  .ci a { display: inline-flex; align-items: center; min-height: 44px; margin: -10px 0; }
}
/* The template's side-by-side city card needs about 420px per column, which a
   four-column row only provides above roughly 1850px. Below that the card stacks. */
@media (max-width: 1850px) {
  .city { flex-direction: column; }
  .city img { width: 100%; height: 200px; }
}

/* touch targets for breadcrumb links and pagination arrows (audit at 360px) */
@media (max-width: 768px) {
  .crumb a { display: inline-block; padding: 12px 8px; margin: -12px -8px; }
  .pg a { min-width: 44px; min-height: 44px; }
}
@media (max-width: 768px) {
  .lnk, .row .acts a.e { display: inline-flex; align-items: center; min-height: 44px; }
  .bell { flex: 0 0 auto; }
  .sign-box .inp, .pay .inp { min-height: 44px; }
}
@media (max-width: 420px) {
  .scard .cnt { gap: 22px; }
}
@media (max-width: 768px) {
  .gallery-nav { width: 44px !important; height: 44px !important; margin-top: -22px !important; }
}
@media (max-width: 768px) {
  .pg a { display: inline-flex; align-items: center; justify-content: center; }
}
@media (max-width: 768px) {
  .slide-nav button { min-width: 44px; min-height: 44px; }
}
@media (max-width: 768px) {
  .contact-list a { display: inline-flex; align-items: center; min-height: 44px; margin: -9px 0; }
  .crumb a { padding: 12px 8px; margin: -12px -8px; }
}
@media (max-width: 400px) {
  .navcols { display: block !important; }
  .navcols ul + ul { margin-top: 0 !important; }
}
@media (max-width: 400px) {
  .foot .cols > div { min-width: 0; }
  .foot .navcols a { overflow-wrap: anywhere; }
}

/* hamburger menu: header and dashboard top bar collapse below 1100px */
@media (max-width: 1100px) {
  .hdr { gap: 12px 16px; }
  .hdr .logo { margin-right: auto; }
  .nav-toggle { display: inline-flex; }
  .hmenu { display: block; flex: 1 1 100%; width: 100%; max-height: 0; overflow: hidden; opacity: 0; transition: max-height .3s ease, opacity .25s ease; }
  .hmenu.open { max-height: calc(100vh - 120px); overflow: auto; opacity: 1; margin-bottom: 12px; }
  .hero-hdr .hmenu { background: #fff; border-radius: 4px; }
  .hero-hdr .hmenu.open { padding: 0 16px 16px; }
  .hero-hdr .hmenu .nav a, .hero-hdr .hmenu .hright, .hero-hdr .hmenu .hright a, .hero-hdr .hmenu .lang-btn { color: #2d2d2d; }
  .hero-hdr .hmenu .hright .sep { background: #dfe3ea; }
  .nav { flex-direction: column; align-items: stretch; gap: 0; }
  .nav > a, .nav-item { width: 100%; }
  .nav > a, .nav-item > a { min-height: 48px; display: flex; align-items: center; border-top: 1px solid #eef0f4; }
  .nav-item { flex-wrap: wrap; position: static; }
  .nav-item > a { flex: 1 1 auto; }
  .nav-item > a svg { display: none; }
  .sub-toggle { display: inline-flex; align-items: center; justify-content: center; width: 48px; min-height: 48px; border: 0; border-top: 1px solid #eef0f4; background: none; color: inherit; cursor: pointer; }
  .sub-toggle svg { transition: transform .25s ease; }
  .nav-item.open > .sub-toggle svg { transform: rotate(180deg); }
  .sub { position: static; display: none; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: 0; border-left: 2px solid #eef0f4; padding: 0 0 0 10px; margin: 0 0 8px 8px; min-width: 0; width: 100%; transition: none; }
  .nav-item.open > .sub { display: block; }
  .nav-item:hover > .sub, .nav-item:focus-within > .sub { display: none; }
  .nav-item.open:hover > .sub, .nav-item.open:focus-within > .sub { display: block; }
  .sub li a { white-space: normal; }
  .hright { flex-direction: column; align-items: stretch; gap: 6px; padding: 12px 0 4px; border-top: 1px solid #eef0f4; }
  .hright .sep { display: none; }
  .hright > a, .hright .lang { min-height: 48px; display: flex; align-items: center; }
  .hright .lang-menu { position: static; box-shadow: none; border: 1px solid #e8ebf0; margin: 0 0 8px; }
  .hright .btn-red { justify-content: center; margin-top: 8px; }
  .hcart { width: auto; justify-content: flex-start; gap: 10px; }
  .hcart::after { content: "Cart"; }
  .hcart b { position: static; }
  .topbar { justify-content: space-between; }
  .topbar .hmenu { order: 3; }
  .topbar nav.hmenu { display: block; }
  .topbar nav.hmenu .nav-item, .topbar nav.hmenu > a { width: 100%; }
  .topbar nav.hmenu > a, .topbar nav.hmenu .nav-item > a { min-height: 48px; display: flex; align-items: center; border-top: 1px solid #eef0f4; font-size: 17px; color: #2d2d2d; }
}

/* dashboard sidebar collapses to its title bar on phones */
@media (max-width: 900px) {
  .side { min-width: 0; max-width: 100%; }
  .side .top { justify-content: flex-start; padding-right: 16px; }
  .side-toggle { display: inline-flex; }
  .side .me, .side .menu { display: none !important; }
  .side.open .me { display: block !important; }
  .side.open .menu { display: block !important; }
}

/* dark header on phones and tablets (same width as the hamburger) */
@media (max-width: 1100px) {
  .fh > header, .hero-hdr { background: var(--brand-secondary) !important; box-shadow: none !important; }
  .hdr .logo, .hdr .logo .logo-text, .hdr .nav a, .hdr .hright, .hdr .hright a, .hdr .lang-btn { color: #fff; }
  .logo .logo-light { display: none; }
  .logo .logo-dark { display: block; }
  .nav-toggle { background: transparent; border-color: rgba(255, 255, 255, .4); }
  .nav-toggle span { background: #fff; }
  .hmenu, .hero-hdr .hmenu { background: var(--brand-secondary); border-radius: 0; }
  .hero-hdr .hmenu.open { padding: 0; }
  .hero-hdr .hmenu .nav a, .hero-hdr .hmenu .hright, .hero-hdr .hmenu .hright a, .hero-hdr .hmenu .lang-btn { color: #fff; }
  .nav > a, .nav-item > a, .sub-toggle, .hright { border-top-color: rgba(255, 255, 255, .12); }
  .sub-toggle { color: #fff; }
  .sub { border-left-color: rgba(255, 255, 255, .2); }
  .sub li a { color: #fff !important; }
  .sub li a:hover { background: rgba(255, 255, 255, .08); }
  .hright .sep, .hero-hdr .hmenu .hright .sep { background: rgba(255, 255, 255, .3); }
  .hright .lang-menu { background: #fff; }
  .hcart b { position: static; }
  .topbar { background: var(--brand-secondary); }
  .topbar nav.hmenu > a, .topbar nav.hmenu .nav-item > a, .topbar .sub-toggle, .topbar .bell, .topbar > span > a, .topbar .who { color: #fff; }
  .topbar nav.hmenu > a, .topbar nav.hmenu .nav-item > a { border-top-color: rgba(255, 255, 255, .12); }
}
/* dark header polish: no light or dark-red accents bleeding in from the desktop styles */
@media (max-width: 1100px) {
  .fh > header, .hero-hdr { border-bottom: 1px solid rgba(255, 255, 255, .08); }
  .hero-hdr .nav-toggle, .fh > header .nav-toggle { background: transparent; border-color: rgba(255, 255, 255, .35); }
  .hero-hdr .nav-toggle span, .fh > header .nav-toggle span { background: #fff; }
  .nav-toggle:hover, .nav-toggle:focus-visible { border-color: rgba(255, 255, 255, .7); }
  .hdr .nav a:hover, .hdr .sub li a:hover, .hdr .hright a:hover, .hmenu a:hover { color: var(--brand-primary) !important; }
  .hdr .sub li a:hover { background: rgba(255, 255, 255, .06); }
  .hdr .logo:hover, .hdr .logo:hover .logo-text { color: #fff; }
  .hdr .hright .btn-red { color: #fff !important; }
  .hdr .hright .btn-red:hover { background: var(--brand-primary-dark); color: #fff !important; }
  .hmenu.open { padding-bottom: 8px; }
  .hright { padding-bottom: 10px; }
  .lang-btn:focus-visible, .nav-item > a:focus-visible, .nav > a:focus-visible, .sub-toggle:focus-visible { outline: 2px solid rgba(255, 255, 255, .6); outline-offset: -2px; }
}

/* dashboard tables: one stacked card per row on phones, labels from data-label */
@media (max-width: 640px) {
  .dash-main table thead, .dash-main .thead { display: none; }
  .dash-main table, .dash-main table tbody, .dash-main table tr, .dash-main table td { display: block; width: 100%; box-sizing: border-box; }
  .dash-main table tr { border-bottom: 1px solid #eef0f4; padding: 12px 0; }
  .dash-main table tr:last-child { border-bottom: 0; }
  .dash-main table td { padding: 6px 0; border: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; text-align: right; white-space: normal; }
  .dash-main table td::before { content: attr(data-label); color: #777; font-size: 13px; text-align: left; flex: 0 0 36%; }
  .dash-main table td:not([data-label])::before, .dash-main table td[data-label=""]::before { content: none; }
  .dash-main table td:not([data-label]) { justify-content: flex-start; text-align: left; }
  .dash-main table td form { display: inline-flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
}
