/* Linh Meo public site: white and ivory, dark text, red for prices and actions,
   gold for small accents (text in gold uses the darker #946a0e). */
:root {
  --red: #c62828;
  --red-dark: #a51f1f;
  --gold: #946a0e;
  --gold-line: #c69214;
  --text: #222;
  --muted: #5f5f5f;
  --line: #e7e1d6;
  --ivory: #fffaf2;
  --soft: #faf5ec;
  --zalo: #0068ff;
  --radius: 12px;
  /* The owner may change these in the theme editor (src/core/theme.ts themeCss). */
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-brand: Georgia, "Times New Roman", serif;
  --base-size: 16px;
  --block-gap: 2.2rem;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

/* Hidden means hidden, whatever display a class gives (hearts and counts wait for site.js). */
[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  background: var(--ivory);
  color: var(--text);
  font: var(--base-size) / 1.55 var(--font-body);
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--red);
}

svg {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  vertical-align: -0.18em;
}

h1,
h2,
h3 {
  line-height: 1.25;
}

.wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 16px;
}

.muted {
  color: var(--muted);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.header-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 68px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  margin-right: auto;
}

.logo img {
  border-radius: 10px;
}

/* Where the row is narrow, a mark wider than square gives way, down to square, not the name. */
.logo-mark {
  min-width: 42px;
  object-fit: contain;
}

.logo span {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.logo b {
  color: var(--red);
  font: 700 1.45rem/1.05 var(--font-brand);
  letter-spacing: 0.02em;
}

.logo small {
  color: var(--gold);
  font: 700 0.68rem/1.2 var(--font-brand);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.nav {
  display: flex;
  gap: 0.25rem;
}

.nav a,
.menu nav a {
  padding: 0.55rem 0.8rem;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  border-radius: 8px;
}

/* A signed-in customer: the initial in a circle, then the name. */
.account-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.account-name {
  max-width: 9em;
  overflow: hidden;
  text-overflow: ellipsis;
}

.avatar-link {
  display: none;
  text-decoration: none;
}

.nav a.active {
  color: var(--red);
  box-shadow: inset 0 -3px 0 var(--red);
  border-radius: 0;
}

.header-call {
  min-height: 42px;
}

.menu {
  display: none;
  position: relative;
}

.menu summary {
  list-style: none;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  cursor: pointer;
  border-radius: 10px;
}

.menu summary::-webkit-details-marker {
  display: none;
}

.menu summary span,
.menu summary span::before,
.menu summary span::after {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  position: relative;
  content: "";
}

.menu summary span::before {
  position: absolute;
  top: -7px;
}

.menu summary span::after {
  position: absolute;
  top: 7px;
}

.menu nav {
  position: absolute;
  right: 0;
  top: 52px;
  display: flex;
  flex-direction: column;
  min-width: 200px;
  padding: 0.4rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

.menu nav a.active {
  color: var(--red);
}

/* Home banner: the owner's picture whole (theme.ts computerBanner, phoneBanner), as wide as the page. */
.hero img {
  display: block;
  width: 100%;
  height: auto;
}

/* Read by screen readers and search engines, not shown: the banner's picture says it. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Finder (home search card) */
.finder {
  position: relative;
  margin-top: var(--block-gap);
}

.finder > .type-switch,
.finder > form {
  background: #fff;
}

.type-switch {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.35rem;
  border-radius: 12px 12px 0 0;
}

.type-switch a {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  white-space: nowrap;
  min-height: 46px;
  padding: 0.5em 1.4em;
  border-radius: 9px;
  background: var(--soft);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.type-switch a.active {
  background: var(--red);
  color: #fff;
}

.finder-form,
.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.3fr) auto;
  gap: 0.9rem 1rem;
  align-items: end;
  padding: 1.1rem 1.2rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 0 16px 16px 16px;
  box-shadow: 0 16px 40px rgba(80, 50, 10, 0.1);
}

.filters {
  margin: 0.5rem 0 1rem;
  background: #fff;
  border-top: 3px solid var(--gold-line);
  border-radius: 16px;
}

/* A filter field: small label above, icon inside, its own arrow; red once set. */
.ff {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.ff-label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* The filter's fields: taller and bold; red once set. ui.css draws the rest. */
.ff :where(select, input) {
  min-height: 52px;
  border-radius: 12px;
  font-weight: 600;
}

.ff input::placeholder {
  font-weight: 500;
}

.ff.is-set :where(select, input) {
  border-color: var(--red);
  background: #fff5f4;
  color: var(--red-dark);
}

.ff.is-set .ui-select > svg:first-child,
.ff.is-set .ui-search > svg {
  color: var(--red);
}

.ff-submit {
  min-height: 52px;
  padding: 0 1.6rem;
  border-radius: 12px;
  background: var(--red);
  background: linear-gradient(180deg, color-mix(in srgb, var(--red) 82%, #fff), var(--red));
  box-shadow: 0 8px 20px color-mix(in srgb, var(--red) 32%, transparent);
  font-size: 1.05rem;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}

.ff-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--red) 40%, transparent);
}

.ff-submit svg {
  width: 1.2rem;
  height: 1.2rem;
}

/* Blocks */
.block {
  margin: var(--block-gap) auto;
}

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.block-head h2 {
  margin: 0 0 0.9rem;
  font-size: 1.45rem;
}

.block-head a {
  white-space: nowrap;
  font-weight: 600;
  text-decoration: none;
}

.cats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}

/* A category as the owner's mockup draws it: a picture with its name under it, no frame around
   them. The picture is the owner's photo (.cat-img, below) or, until there is one, a drawing. */
.cat {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  color: var(--text);
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
}

.cat-icon {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  background: #fbf0d8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--gold);
}

.cat-icon svg {
  width: 34px;
  height: 34px;
}

.cat:hover .cat-icon {
  border-color: var(--gold-line);
}

.cat:hover .cat-img {
  filter: brightness(1.06);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: box-shadow 0.15s;
}

.card:hover {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.card-photo {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--soft);
}

.card-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tag {
  display: inline-block;
  padding: 0.15em 0.6em;
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
}

.tag-rent {
  background: var(--red);
}

.tag-sale {
  background: #1f1f1f;
}

.card-photo .tag {
  position: absolute;
  left: 0.6rem;
  top: 0.6rem;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 0.85rem 0.85rem;
}

.card-body h3 {
  margin: 0;
  font-size: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price {
  margin: 0;
  color: var(--red);
  font-weight: 800;
  font-size: 1.15rem;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.8rem;
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
}

.card-code {
  color: var(--muted);
  font-size: 0.78rem;
}

.card-wrap .card-meta,
.card-wrap .card-code {
  padding-right: 2.4rem;
}

.empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* Nothing found: an icon, the reason in bold, the way out. */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 2.4rem 1rem 2.2rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  text-align: center;
}

.empty-state p {
  margin: 0;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 0.4rem;
  border-radius: 50%;
  background: #fbf0d8;
  color: var(--gold);
}

.empty-icon svg {
  width: 30px;
  height: 30px;
}

.empty-title {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
}

.empty-state .btn {
  margin-top: 0.8rem;
}

.empty-state .row {
  justify-content: center;
  margin-top: 0.8rem;
}

.empty-state .row .btn {
  margin-top: 0;
}

.contact-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}

/* Zalo and call as round buttons in the screen's corner, on every page (ui.tsx CornerContact). */
.corner-contact {
  position: fixed;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.corner-contact .btn {
  position: relative;
  width: 54px;
  height: 54px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 800;
  box-shadow:
    0 0 0 5px rgba(255, 255, 255, 0.9),
    0 4px 14px rgba(0, 0, 0, 0.22);
}

.corner-contact .btn svg {
  width: 26px;
  height: 26px;
}

/* The call is green, as hotline buttons are (Hải, 31/10). */
.corner-contact .corner-call,
.corner-contact .corner-call:hover:not(:disabled) {
  border-color: #16a34a;
  background: #16a34a;
  color: #fff;
}

.corner-contact .corner-call:hover:not(:disabled) {
  border-color: #15803d;
  background: #15803d;
}

/* It rings: two waves spread from it while the handset shakes, then a pause. Zalo hops
   now and then, so the eye finds it too. Nothing moves where the phone asks for less motion. */
.corner-call::before,
.corner-call::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 3px solid #22c55e;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  animation: corner-wave 2.4s ease-out infinite;
}

.corner-call::after {
  animation-delay: 0.6s;
}

.corner-call svg {
  animation: corner-shake 2.4s ease-in-out infinite;
}

.corner-zalo {
  animation: corner-hop 4.8s ease-in-out 1.2s infinite;
}

@keyframes corner-wave {
  0% {
    opacity: 0.9;
    transform: scale(1);
  }
  60%,
  100% {
    opacity: 0;
    transform: scale(1.55);
  }
}

@keyframes corner-shake {
  0%,
  45%,
  100% {
    transform: rotate(0);
  }
  5%,
  15%,
  25%,
  35% {
    transform: rotate(-18deg);
  }
  10%,
  20%,
  30%,
  40% {
    transform: rotate(18deg);
  }
}

@keyframes corner-hop {
  0%,
  78%,
  100% {
    transform: translateY(0);
  }
  84% {
    transform: translateY(-8px);
  }
  90% {
    transform: translateY(0);
  }
  94% {
    transform: translateY(-3px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .corner-call::before,
  .corner-call::after {
    display: none;
  }

  .corner-call svg,
  .corner-zalo {
    animation: none;
  }
}

/* List page */
.breadcrumb {
  margin: 1rem 0 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.breadcrumb a {
  color: var(--muted);
}

.list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.list-head h1 {
  margin: 0;
  font-size: 1.7rem;
}

.list-head .type-switch {
  border-radius: 12px;
  background: #fff;
}

/* Categories on the list page: one row of chips, the current one in red. */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 0.4rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 42px;
  padding: 0.4rem 1rem;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition:
    border-color 0.15s,
    background-color 0.15s;
}

.chip svg {
  width: 1.1rem;
  height: 1.1rem;
  color: var(--gold-line);
}

.chip:hover {
  border-color: var(--gold-line);
}

.chip.active {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

.chip.active svg {
  color: #fff;
}

.result-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 1rem 0;
  color: var(--muted);
  min-height: 1.5em;
}

/* A filter in use; its cross takes it away. */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 36px;
  padding: 0.25rem 0.55rem 0.25rem 0.8rem;
  border: 1.5px solid var(--red);
  border-radius: 999px;
  background: #fff5f4;
  color: var(--red-dark);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
}

.filter-chip svg {
  width: 1rem;
  height: 1rem;
}

.clear {
  font-weight: 600;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0;
}

.pager a {
  padding: 0.55rem 1rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font-weight: 600;
  text-decoration: none;
}

/* Detail page */
.closed-banner {
  margin: 0.5rem 0;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  background: #1f1f1f;
  color: #fff;
  font-weight: 800;
  text-align: center;
  font-size: 1.1rem;
}

.detail-top {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.gallery {
  position: relative;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  border-radius: var(--radius);
  background: #1f1f1f;
  scrollbar-width: none;
}

.shot {
  flex: 0 0 100%;
  scroll-snap-align: start;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  cursor: zoom-in;
}

.shot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.shot-count {
  position: absolute;
  right: 0.7rem;
  bottom: 0.7rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.25em 0.7em;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.85rem;
  pointer-events: none;
}

/* The big photo's frame: the count and the arrows stay put while the photos slide under them. */
.gallery-wrap {
  position: relative;
}

/* The arrows, on a computer (site.js shows them; a phone swipes). */
.gallery-nav {
  position: absolute;
  top: 50%;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  transform: translateY(-50%);
}

.gallery-nav:hover:not(:disabled) {
  background: #fff;
}

.gallery-prev {
  left: 12px;
}

.gallery-next {
  right: 12px;
}

.gallery-nav svg {
  width: 24px;
  height: 24px;
}

/* Every photo small under the big one, all in view on a computer; a tap shows it big (site.js). */
.thumbs {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.thumbs a {
  flex: none;
  width: 92px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 8px;
  opacity: 0.7;
  outline: 3px solid transparent;
  outline-offset: -3px;
  transition: opacity 0.15s;
}

.thumbs a:hover,
.thumbs a.active {
  opacity: 1;
}

.thumbs a.active {
  outline-color: var(--red);
}

.thumbs img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.summary {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.summary h1 {
  margin: 0;
  font-size: 1.45rem;
}

.summary-tags {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
}

.code {
  color: var(--muted);
  font-size: 0.85rem;
}

.price-big {
  font-size: 1.75rem;
}

.summary .contact-buttons {
  justify-content: flex-start;
}

.summary .contact-buttons .btn {
  flex: 1 1 auto;
}

.share {
  width: 100%;
}

.share-links {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.facts,
.desc {
  margin-top: 1.5rem;
  padding: 1.1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.facts h2,
.desc h2 {
  margin: 0 0 0.7rem;
  font-size: 1.2rem;
}

.facts dl {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.25rem 1.5rem;
  margin: 0;
}

.facts dl div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--soft);
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

.content {
  margin: 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.fixed-notice {
  margin: 1.25rem 0 0;
  padding: 1rem 1.1rem;
  border: 2px solid var(--gold-line);
  border-radius: var(--radius);
  background: #fff8e6;
  color: var(--red-dark);
  font-weight: 700;
  text-align: center;
}

.contact-bar {
  display: none;
}

/* Contact page and 404 */
.contact-page,
.not-found {
  padding-bottom: 3rem;
}

.contact-list {
  display: grid;
  gap: 0.6rem;
  max-width: 560px;
  padding: 1.1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.contact-list div {
  display: flex;
  gap: 1rem;
}

.contact-list dt {
  min-width: 100px;
  color: var(--muted);
}

.contact-list dd {
  margin: 0;
  font-weight: 600;
}

.contact-page .contact-buttons {
  justify-content: flex-start;
  margin-top: 1rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* Footer */
.site-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  background: #1f1f1f;
  color: #e9e4da;
}

.site-footer a {
  color: #ffd27a;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.2fr 1.5fr 1fr;
  gap: 1.5rem;
}

.footer-grid p {
  margin: 0.25rem 0;
}

.footer-grid nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.footer-brand {
  color: #ffffff;
  font: 700 1.5rem var(--font-brand);
  letter-spacing: 0.03em;
}

.copyright {
  margin: 1.5rem auto 0;
  padding-top: 1rem;
  padding-bottom: 1.5rem;
  border-top: 1px solid #3a3a3a;
  color: #b8b2a6;
  font-size: 0.85rem;
}

/* Photo viewer (site.js) */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
}

.lightbox img {
  max-width: 100vw;
  max-height: 86vh;
  object-fit: contain;
}

.lightbox button {
  position: absolute;
  min-width: 48px;
  min-height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
}

.lightbox .lb-close {
  top: 12px;
  right: 12px;
}

.lightbox .lb-prev {
  left: 12px;
}

.lightbox .lb-next {
  right: 12px;
}

.lightbox .lb-count {
  position: absolute;
  bottom: 14px;
  color: #fff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  z-index: 110;
  transform: translateX(-50%);
  padding: 0.7rem 1rem;
  border-radius: 10px;
  background: #222;
  color: #fff;
}

/* The call button keeps only its icon where the menu needs the room. */
@media (max-width: 1100px) {
  .header-call span {
    display: none;
  }

  .header-call {
    width: 46px;
    padding: 0;
  }
}

@media (max-width: 900px) {
  .nav {
    display: none;
  }

  .header-row {
    gap: 0.5rem;
  }

  .header-call {
    flex: none;
  }

  .avatar-link {
    display: inline-flex;
  }

  .avatar-link .ui-avatar {
    width: 2.1rem;
    height: 2.1rem;
    font-size: 1rem;
  }

  .menu {
    display: block;
  }

  .finder-form,
  .filters {
    grid-template-columns: 1fr 1fr;
  }

  .finder-form .q,
  .filters .q,
  .finder-form .btn,
  .filters .btn {
    grid-column: 1 / -1;
  }

  .detail-top {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .logo b {
    font-size: 1.2rem;
  }

  .logo small {
    font-size: 0.56rem;
    letter-spacing: 0.03em;
  }

  .type-switch {
    display: flex;
  }

  .type-switch a {
    flex: 1;
    justify-content: center;
  }

  .list-head .type-switch {
    width: 100%;
  }

  .finder-form,
  .filters {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 1rem;
  }

  .finder-form {
    border-radius: 0 0 16px 16px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .cats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .cat {
    gap: 0.35rem;
    font-size: 0.85rem;
  }

  .cat-icon svg {
    width: 28px;
    height: 28px;
  }

  /* Folded by site.js: the keyword, then "Bộ lọc" and "Tìm kiếm" side by side, each on one line. */
  .filters.folding {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .filters.folding .ff {
    grid-column: 1 / -1;
  }

  .filters.folding:not(.open) .ff:not(.q),
  .filters.folding .ff-cat {
    display: none;
  }

  .filters.folding .btn {
    grid-column: auto;
    min-height: 52px;
    white-space: nowrap;
  }

  .filters.folding .ff-submit {
    padding: 0 1.1rem;
  }

  /* On a phone the chips scroll sideways instead of taking several lines. */
  .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-left: -16px;
    margin-right: -16px;
    padding: 0 16px 0.3rem;
    scrollbar-width: none;
  }

  .chips::-webkit-scrollbar {
    display: none;
  }

  /* A phone swipes the big photo, and its small ones scroll sideways in one row. */
  .gallery-nav {
    display: none;
  }

  .thumbs {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-left: -16px;
    margin-right: -16px;
    padding: 0 16px;
    scrollbar-width: none;
  }

  .thumbs::-webkit-scrollbar {
    display: none;
  }

  .thumbs a {
    width: 76px;
  }

  .contact-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    gap: 0.5rem;
    padding: 0.6rem 16px calc(0.6rem + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.08);
  }

  .contact-bar .btn {
    flex: 1;
  }

  body:has(.contact-bar) .copyright {
    padding-bottom: 5.5rem;
  }

  /* A listing keeps its own bar at the bottom of the screen instead of the corner's buttons. */
  body:has(.contact-bar) .corner-contact {
    display: none;
  }

  .contact-page .contact-buttons .btn {
    flex: 1 1 100%;
  }

  .block-head h2 {
    font-size: 1.25rem;
    text-wrap: balance;
  }

  .detail {
    padding-bottom: 5rem;
  }
}

.videos {
  margin: 1.5rem 0;
}

.videos video {
  display: block;
  width: 100%;
  max-height: 70vh;
  height: auto;
  background: #000;
  border-radius: 12px;
}

.videos video + video {
  margin-top: 0.8rem;
}

.card-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
}

.card-wrap > .card {
  flex: 1;
}

.fav {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--red);
  cursor: pointer;
}

.fav svg {
  width: 1.25rem;
  height: 1.25rem;
}

.fav[aria-pressed="true"] svg {
  fill: currentColor;
}

.fav-wide {
  position: static;
  width: auto;
  height: auto;
  gap: 0.4rem;
  display: inline-flex;
  padding: 0 1rem;
  border: 2px solid var(--red);
  border-radius: 10px;
}

.fav-wide:hover {
  background: #fff5f4;
}

.fav-count {
  display: inline-block;
  min-width: 1.3rem;
  margin-left: 0.3rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 0.75rem;
  line-height: 1.3rem;
  text-align: center;
}

.fav-status {
  margin: 0 0 0.3rem;
  font-weight: 700;
  color: #6b4a00;
}

.fav-gone .card {
  opacity: 0.7;
}

.box-note {
  margin: 1rem 0;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.prose {
  max-width: 760px;
}

.prose h2 {
  margin-top: 1.5rem;
}

/* Theme: the owner's logo picture, category pictures, benefits and intro blocks, preview notice */
.logo-img {
  display: block;
  height: 44px;
  width: auto;
  max-width: min(60vw, 260px);
  object-fit: contain;
}

.cat-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  background: #fbf0d8;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.benefits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.8rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.benefits li {
  padding: 1rem;
  border: 1px solid var(--gold-line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--red);
  font: 700 1.1rem/1.3 var(--font-brand);
  text-align: center;
}

.intro p {
  max-width: 70ch;
  white-space: pre-line;
}

.preview-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  margin: 0;
  padding: 0.5rem 16px;
  background: #222;
  color: #fff;
  font-size: 0.9rem;
  text-align: center;
}

/* Staff only (ui.tsx htmlPage): which side they are on, and the red button back to the admin. */
.staff-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0;
  padding: 0.4rem 16px;
  background: #fff3f3;
  border-bottom: 1px solid #f3c9c9;
  font-size: 0.9rem;
  font-weight: 600;
}

.staff-bar .btn {
  flex: none;
  min-height: 36px;
  padding: 0.3em 0.9em;
  font-size: 0.9rem;
}

.staff-bar .btn svg {
  width: 18px;
  height: 18px;
}

/* The narrowest phones: the brand a little smaller, so the buttons beside it fit. */
@media (max-width: 370px) {
  .logo b {
    font-size: 1.08rem;
  }

  .logo small {
    font-size: 0.5rem;
  }
}
