/* GhodaGaadi — app-style layout for phones (below 768px). Loaded after style.css.
   Desktop (768px and wider) keeps the layout from style.css; rules outside the
   mobile media query below have no visual effect there (except the logged-out Account list). */

/* ---------- all widths (no visible change on desktop) ---------- */
html { -webkit-tap-highlight-color: transparent; }
a, button, input, select, textarea, label, summary { touch-action: manipulation; }
body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.m-appbar, .sheet-close, .card-chev, #gg-progress { display: none; }

/* Bottom tab bar: identical size and alignment on every page (phones and inside the app). */
.app-tabs { box-sizing: border-box; height: calc(65px + env(safe-area-inset-bottom, 0px)); align-items: start; -webkit-user-select: none; user-select: none; }
.app-tabs a { box-sizing: border-box; height: 56px; min-height: 56px; min-width: 0; gap: 4px; padding: 0 2px; justify-content: center; font: 600 12px/16px var(--body); }
.app-tabs a svg, .app-tabs a .micon { flex: none; display: block; width: auto; height: 24px; }
.app-tabs a span { display: block; max-width: 100%; height: 16px; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lang-hi .app-tabs a { font-size: 13px; }

@media (min-width: 768px) {
  .m-only { display: none !important; }
  body:not(.in-app) .app-tabs { display: none; }
}

/* ---------- Account menu (mobile Account tab; also the logged-out account page on desktop) ---------- */
.acct-page { padding-top: 20px; padding-bottom: 32px; max-width: 640px; }
.acct-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.acct-head > div { min-width: 0; }
.acct-head h1 { font-size: 24px; margin: 0 0 2px; overflow-wrap: anywhere; }
.acct-head p { margin: 0; font-size: 15px; }
.acct-head .avatar { width: 64px; height: 64px; font-size: 24px; }
.acct-group { font: 700 13px/1.2 var(--body); text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 22px 4px 8px; }
.acct-list { list-style: none; margin: 0 0 12px; padding: 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.acct-list li + li { border-top: 1px solid var(--line); }
.acct-row { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 8px 12px 8px 14px; text-decoration: none; color: var(--ink); font-weight: 500; }
.acct-row:hover { background: var(--yellow-soft); color: var(--ink); }
.acct-ico { width: 38px; height: 38px; flex: none; border-radius: 10px; background: var(--yellow-soft); display: grid; place-items: center; }
.acct-label { flex: 1; min-width: 0; overflow-wrap: anywhere; line-height: 1.3; }
.acct-val { color: var(--muted); font-size: 14px; white-space: nowrap; }
.acct-chev { display: flex; color: #8C846F; flex: none; }
.acct-danger, .acct-danger:hover { color: var(--red); }
.acct-danger .acct-ico { background: var(--red-bg); }

/* =====================================================================
   PHONES
   ===================================================================== */
@media (max-width: 767.98px) {
  :root { --appbar-h: 56px; --tabbar-h: 65px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px); }
  .d-only { display: none !important; }

  body { padding-bottom: calc(var(--tabbar-h) + var(--safe-b)); }

  /* --- hide desktop chrome --- */
  .site-header, .site-footer, .fab-call, .menu-mobile { display: none !important; }

  /* --- top app bar --- */
  .m-appbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 4px; min-height: calc(var(--appbar-h) + var(--safe-t)); padding: var(--safe-t) 8px 0 4px; background: var(--bg); border-bottom: 1px solid var(--line); -webkit-user-select: none; user-select: none; }
  .m-appbar-home { padding-left: 12px; }
  .m-appbar .brand { gap: 8px; min-width: 0; }
  .m-appbar .brand img { border-radius: 9px; }
  .m-appbar .brand-name { font-size: 22px; }
  .m-title { flex: 1; min-width: 0; font: 700 18px/1.25 var(--head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-top: 2px; }
  .m-appbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
  .m-appbar .lang-toggle { min-height: 40px; padding: 4px 12px; font-size: 14px; border-radius: 99px; color: var(--ink); }
  .m-icon-btn { width: 48px; height: 48px; flex: none; display: grid; place-items: center; border-radius: 50%; color: var(--ink); text-decoration: none; }
  .m-icon-btn:active { background: var(--yellow-soft); }
  .m-call { width: 42px; height: 42px; background: var(--green); color: #fff; }
  .m-call:hover, .m-call:active { background: #17602F; color: #fff; }

  /* --- bottom tab bar --- */
  .app-tabs { -webkit-user-select: none; user-select: none; }
  .app-tabs a:active { background: var(--yellow-soft); color: var(--ink); }

  /* --- app feel --- */
  .btn, .m-chip, .m-quick-card, .m-type, .acct-row, .mini-card, .m-how-link, .m-row-link { -webkit-user-select: none; user-select: none; }
  .btn:active { transform: translateY(2px); }
  .btn-primary:active { box-shadow: 0 1px 0 var(--ink); background: #E5A800; }
  .btn-dark:active { background: #000; }
  .btn-outline:active { background: var(--yellow-soft); }
  .m-type:active, .m-quick-card:active, .mini-card:active { transform: scale(.97); }
  .acct-row:active, .m-how-link:active, .m-row-link:active { background: var(--yellow-soft); }
  #gg-progress { display: block; position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--yellow); box-shadow: 0 1px 4px rgba(176, 127, 0, .6); z-index: 200; opacity: 0; pointer-events: none; }
  #gg-progress.run { opacity: 1; width: 85%; transition: width 6s cubic-bezier(.08, .8, .2, 1); }
  #gg-progress.done { opacity: 0; width: 100%; transition: width .2s, opacity .3s .2s; }

  /* --- general spacing --- */
  .wrap { padding: 0 16px; }
  .alert { margin-top: 12px; }
  h2 { font-size: 22px; }
  .empty { padding: 28px 16px; }

  /* --- shared search field --- */
  .m-search { display: flex; align-items: center; gap: 8px; background: #fff; border: 1.5px solid #CFC6AE; border-radius: 14px; padding: 0 4px 0 12px; min-height: 52px; }
  .m-search:focus-within { border-color: var(--ink); outline: 3px solid var(--yellow); }
  .m-search > .ico { flex: none; color: var(--muted); }
  .m-search input[type=search] { flex: 1; min-width: 0; min-height: 48px; border: 0; padding: 0; background: transparent; outline: none; }
  .m-search input[type=search]:focus { outline: none; }
  .m-search-go { flex: none; width: 44px; height: 44px; border: 0; border-radius: 10px; background: var(--yellow); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
  .m-search-go:active { background: #E5A800; }

  /* --- home --- */
  .m-home { padding: 16px 0 4px; }
  .m-greet { margin: 0; font-weight: 600; color: var(--muted); font-size: 15px; }
  .m-greet-sub { font-size: 24px; font-weight: 800; margin: 2px 0 14px; }
  .m-section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 24px 0 10px; }
  .m-section-head h2, .m-section-head h1 { font-size: 20px; margin: 0; }
  .m-section-head-main h1 { font-size: 22px; font-weight: 800; }
  .m-section-head a { flex: none; font-weight: 600; color: #6B4F00; padding: 10px 0; }
  .m-type-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .m-type { display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 100px; padding: 10px 4px 8px; background: #fff; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; text-align: center; transition: transform .1s; }
  .m-type-ico { width: 46px; height: 46px; border-radius: 12px; background: var(--yellow-soft); display: grid; place-items: center; }
  .m-type .micon { width: 40px; height: 25px; color: var(--ink); }
  .m-type-name { font-size: 12px; line-height: 1.25; font-weight: 600; overflow-wrap: anywhere; hyphens: auto; }
  .lang-hi .m-type-name { font-size: 13px; }
  .m-quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
  .m-quick-card { display: flex; flex-direction: column; justify-content: space-between; gap: 10px; min-height: 104px; padding: 12px 10px; border: 2px solid var(--ink); border-radius: 14px; background: var(--yellow); color: var(--ink); text-decoration: none; font: 700 15px/1.2 var(--head); box-shadow: 0 3px 0 var(--ink); transition: transform .1s; }
  .m-quick-card span { overflow-wrap: anywhere; }
  .m-quick-card:nth-child(3) { background: #fff; }
  .m-quick-dark, .m-quick-dark:hover { background: var(--ink); color: #fff; }
  .m-hscroll { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 16px; padding: 2px 16px 14px; scrollbar-width: none; overscroll-behavior-x: contain; }
  .m-hscroll::-webkit-scrollbar { display: none; }
  .mini-card { flex: 0 0 min(72vw, 270px); scroll-snap-align: start; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; text-decoration: none; box-shadow: var(--shadow); transition: transform .1s; }
  .mini-media { aspect-ratio: 16 / 10; background: var(--yellow-soft); display: grid; place-items: center; overflow: hidden; }
  .mini-media img { width: 100%; height: 100%; object-fit: cover; }
  .mini-media .micon { color: #8A6400; }
  .mini-body { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 12px; min-width: 0; }
  .mini-body strong { font: 700 17px/1.25 var(--head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mini-meta { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mini-meta .ico { display: inline; vertical-align: -2px; margin-right: 3px; }
  .m-how-link, .m-row-link { display: flex; align-items: center; gap: 10px; min-height: 56px; margin: 6px 0 16px; padding: 10px 14px; background: #fff; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; font-weight: 600; }
  .m-how-link span, .m-row-link span { flex: 1; min-width: 0; }
  .m-how-link > .ico:first-child { color: var(--green); }
  .m-row-link { margin: 12px 0 0; }
  .m-row-link > .ico:first-child { color: var(--ink); }
  .home-how { display: none; padding: 28px 0; scroll-margin-top: calc(var(--appbar-h) + var(--safe-t)); }
  .home-how:target { display: block; }
  .step { padding: 16px; }

  /* --- listings: sticky search + chips --- */
  .m-listbar { position: sticky; top: calc(var(--appbar-h) + var(--safe-t)); z-index: 20; margin: 0 -16px; padding: 10px 16px 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
  .m-listbar .m-search { min-height: 48px; }
  .m-listbar .m-search input[type=search] { min-height: 44px; }
  .m-listbar .m-search-go { width: 40px; height: 40px; }
  .m-chips { display: flex; gap: 8px; overflow-x: auto; margin: 10px -16px 0; padding: 0 16px 2px; scrollbar-width: none; overscroll-behavior-x: contain; }
  .m-chips::-webkit-scrollbar { display: none; }
  .m-chip-row { display: flex; gap: 8px; flex: none; }
  .m-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 99px; border: 1.5px solid #CFC6AE; background: #fff; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; }
  .m-chip[aria-current="true"], .m-chip.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }
  .m-listbar-nosearch .m-chips { margin-top: 0; }
  .m-chip-icon { position: relative; min-height: 44px; padding: 0 10px; }
  .m-chip-icon .micon { width: 44px; height: 28px; }
  .m-chip-select { position: relative; padding: 0 10px 0 12px; }
  .m-chip-select > .ico { flex: none; }
  .m-chip-select select { width: auto; max-width: 150px; min-height: 38px; padding: 0 18px 0 0; border: 0; border-radius: 0; background: transparent; color: inherit; font: inherit; -webkit-appearance: none; appearance: none; cursor: pointer; }
  .m-chip-select select:focus { outline: none; }
  .m-chip-select:focus-within { outline: 3px solid var(--blue); outline-offset: 2px; }
  .m-chip-select::after { content: ""; position: absolute; right: 13px; top: 50%; width: 7px; height: 7px; margin-top: -5px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); pointer-events: none; }
  .m-chip-select option { color: var(--ink); background: #fff; }
  .m-chip-go { min-height: 30px; margin-left: 4px; padding: 0 10px; border: 0; border-radius: 99px; background: var(--yellow); color: var(--ink); font: 700 13px/1 var(--body); cursor: pointer; }
  .js .m-chip-go { display: none; }
  .m-chip-select.is-on .m-chip-go { background: #fff; }

  /* --- listings: compact rows instead of cards --- */
  .result-count { margin: 12px 0 8px; font-size: 14px; }
  .card-grid { display: block; margin: 0 -16px; background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .card { position: relative; flex-direction: row; align-items: center; gap: 12px; min-height: 84px; padding: 12px 12px 12px 16px; border: 0; border-radius: 0; box-shadow: none; }
  .card + .card { border-top: 1px solid var(--line); }
  .card:active { background: var(--yellow-soft); }
  .card-media { flex: none; width: 72px; height: 72px; aspect-ratio: auto; border-radius: 12px; }
  .card-media .micon { width: 56px; height: auto; }
  .card-body { padding: 0; gap: 3px; min-width: 0; flex: 1; }
  .card-body h3 { font-size: 17px; line-height: 1.25; overflow-wrap: anywhere; }
  .card-body h3 a { text-decoration: none; }
  .card-body h3 a::after { content: ""; position: absolute; inset: 0; }
  .card-type { font-size: 11px; line-height: 1.3; }
  .card-meta { font-size: 13px; gap: 1px 10px; }
  .card-meta span { min-width: 0; overflow-wrap: anywhere; }
  .card-meta .ico { flex: none; }
  .card-chips, .card-foot { display: none; }
  .card-chev { display: flex; flex: none; color: #8C846F; }
  .card .op-head { gap: 12px; }
  .card .avatar { width: 72px; height: 72px; border-radius: 12px; font-size: 26px; }
  .card .op-head + .card-meta { display: none; }
  .card .op-head > div { min-width: 0; }
  .pager { gap: 10px; margin: 20px 0 8px; }
  .pager a { min-height: 48px; display: inline-flex; align-items: center; }
  .list-end { height: 16px !important; }

  /* --- detail pages --- */
  .detail-grid { gap: 12px; padding: 0 0 16px; }
  .m-gallery { position: relative; margin: 0 -16px; }
  .m-gallery-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; aspect-ratio: 4 / 3; background: var(--yellow-soft); overscroll-behavior-x: contain; }
  .m-gallery-track::-webkit-scrollbar { display: none; }
  .m-gallery-track:focus-visible { outline-offset: -3px; }
  .m-gallery-track > * { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: center; scroll-snap-stop: always; }
  .m-gallery-empty { display: grid; place-items: center; }
  .m-gallery-empty .micon { width: 60%; height: auto; color: #8A6400; }
  .m-dots { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; gap: 6px; pointer-events: none; }
  .m-dots span { width: 7px; height: 7px; border-radius: 99px; background: rgba(255, 255, 255, .75); box-shadow: 0 0 0 1px rgba(0, 0, 0, .3); transition: width .2s, background .2s; }
  .m-dots span.on { width: 20px; background: #fff; }
  .detail-grid h1 { font-size: 26px; margin-top: 14px !important; overflow-wrap: anywhere; }
  .detail-grid .op-head h1 { margin-top: 0 !important; }
  .spec { width: calc(100% + 32px); margin: 12px -16px; border-radius: 0; border-left: 0; border-right: 0; }
  .spec th, .spec td { padding: 14px 16px; font-size: 15px; }
  .spec th { width: 40%; }
  .spec td { overflow-wrap: anywhere; }
  .panel { padding: 16px; box-shadow: none; border-width: 1.5px; }
  .panel h2 { font-size: 22px; }
  .m-actionbar { position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-b)); z-index: 25; padding: 10px 16px; background: rgba(255, 251, 240, .97); border-top: 1px solid var(--line); }
  .m-actionbar .btn { min-height: 52px; }

  /* bottom sheet (only with JS; without JS the form stays a normal section) */
  .js .sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; max-height: 90vh; max-height: calc(100dvh - 40px); overflow-y: auto; overscroll-behavior: contain; margin: 0; border: 0; border-radius: 20px 20px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, .25); padding: 8px 16px calc(20px + var(--safe-b)); transform: translateY(105%); visibility: hidden; transition: transform .28s ease, visibility 0s linear .28s; }
  .js .sheet.open { transform: none; visibility: visible; transition: transform .28s ease; }
  .js .sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: #D8D0BA; margin: 2px auto 10px; }
  .js .sheet h2 { padding-right: 48px; }
  .js .sheet-close { display: grid; place-items: center; position: absolute; top: 10px; right: 8px; width: 48px; height: 48px; border: 0; border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; }
  .js .sheet-close:active { background: var(--yellow-soft); }
  .sheet-backdrop { position: fixed; inset: 0; z-index: 65; background: rgba(28, 28, 28, .5); opacity: 0; transition: opacity .25s; }
  .sheet-backdrop.open { opacity: 1; }
  body.sheet-open { overflow: hidden; }
  @media (prefers-reduced-motion: reduce) { .js .sheet, .js .sheet.open, .sheet-backdrop { transition: none; } }

  /* --- forms: edge to edge, big targets, sticky submit --- */
  .form-page { padding-top: 16px; padding-bottom: 0; }
  .form-page > h1 { font-size: 26px; margin-bottom: 6px; }
  .form-card, .form-card.narrow { max-width: none; margin-top: 12px !important; padding: 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; }
  .form-card h1 { font-size: 26px !important; }
  .form-page .alert { max-width: none !important; }
  fieldset { margin-bottom: 18px; }
  legend { font-size: 19px; }
  .field { margin-bottom: 14px; }
  .toggle-row label { flex: 1 1 auto; }
  .form-page .form-submit { position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-b)); z-index: 15; display: flex; align-items: center; gap: 12px; margin: 12px -16px 0; padding: 10px 16px; background: rgba(255, 251, 240, .97); border-top: 1px solid var(--line); }
  .form-page .form-submit .btn { flex: 1; min-height: 52px; }
  .form-page .form-submit > a { display: inline-flex; align-items: center; min-height: 48px; padding: 0 8px; font-weight: 600; }
  .form-foot { margin-top: 18px; }
  .form-foot a { display: inline-block; padding: 8px 4px; font-weight: 600; }

  /* --- account tab --- */
  .acct-page { padding-top: 16px; padding-bottom: 8px; }
  .wrap .m-only.acct-page { padding-left: 0; padding-right: 0; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); padding-bottom: 24px; }
  .dash-grid section { scroll-margin-top: calc(var(--appbar-h) + var(--safe-t) + 8px); }
  .dash-grid h2 { font-size: 20px; }
}

/* very small phones */
@media (max-width: 374.98px) {
  .m-appbar .brand-name { font-size: 20px; }
  .m-quick-card { font-size: 14px; padding: 10px 8px; }
  .m-type-name { font-size: 11px; }
  .lang-hi .m-type-name { font-size: 12px; }
}
