/* ==========================================================================
   Lead-generation website — mobile-first styles.
   Brand colour comes from COMPANY_SETTINGS.THEME_COLOR (injected as --brand).
   ========================================================================== */
:root {
  --brand: #1f2937;
  --brand-contrast: #fff;
  --ink: #0f172a;
  --ink-2: #475569;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --surface: #fff;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --ok: #047857;
  --ok-bg: #ecfdf5;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgb(15 23 42 / .06), 0 8px 24px rgb(15 23 42 / .06);
  --tap: 48px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 var(--font); color: var(--ink); background: var(--bg); }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); }
h2 { font-size: clamp(1.25rem, 3.6vw, 1.6rem); }
p { margin: 0 0 .75rem; }
.muted { color: var(--ink-2); }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.visually-hidden, .hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, #fff); outline-offset: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: var(--tap); padding: .7rem 1.2rem; border-radius: 999px; border: 2px solid transparent;
  font: 600 1rem/1.1 var(--font); text-decoration: none; cursor: pointer; transition: transform .08s, filter .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: var(--brand-contrast); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--brand); border-color: currentColor; }
.btn-lg { min-height: 54px; font-size: 1.05rem; padding: .85rem 1.6rem; }
.btn-block { width: 100%; }
.link { color: var(--brand); font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ---------- Header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.brand { display: flex; align-items: center; text-decoration: none; min-height: var(--tap); }
.brand-logo { height: 40px; width: auto; max-width: 180px; object-fit: contain; }
.brand-name { font-weight: 800; font-size: 1.15rem; }
.header-call { min-height: 42px; padding: .45rem .9rem; font-size: .95rem; }
.header-call-text { display: none; }
.cat-nav { border-top: 1px solid var(--line); }
.cat-nav-inner { display: flex; gap: 8px; overflow-x: auto; padding-top: 8px; padding-bottom: 8px; scrollbar-width: none; }
.cat-nav-inner::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: .45rem 1rem; border-radius: 999px; border: 1px solid var(--line);
  text-decoration: none; font-weight: 600; font-size: .92rem; background: var(--surface); white-space: nowrap;
}
.chip.is-active { background: var(--brand); color: var(--brand-contrast); border-color: var(--brand); }

/* ---------- Hero / home ---------- */
.hero { position: relative; overflow: hidden; background: var(--brand); color: #fff; }
.hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero.has-image::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgb(0 0 0 / .25), rgb(0 0 0 / .6)); }
.hero-inner { position: relative; z-index: 1; padding-top: 56px; padding-bottom: 56px; }
.hero-title { font-size: clamp(1.9rem, 7vw, 3.2rem); max-width: 18ch; margin-bottom: .75rem; }
.hero-sub { font-size: 1.08rem; max-width: 56ch; opacity: .95; margin-bottom: 1.5rem; }
.hero .btn-primary { background: #fff; color: var(--brand); }
.stats { padding-top: 24px; padding-bottom: 40px; }
.stats-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat {
  display: flex; flex-direction: column; gap: 2px; padding: 18px 16px; min-height: 108px; justify-content: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; box-shadow: var(--shadow);
}
.stat-num { font-size: 2.2rem; font-weight: 800; color: var(--brand); line-height: 1; }
.stat-label { color: var(--ink-2); font-weight: 600; }
.stat-total { background: var(--brand); border-color: var(--brand); }
.stat-total .stat-num, .stat-total .stat-label { color: var(--brand-contrast); }
.stats-cta { margin-top: 20px; display: flex; justify-content: center; }
.stats-cta .btn { width: 100%; }

/* ---------- Listing ---------- */
.page-head { padding-top: 24px; padding-bottom: 8px; }
.page-head .lead { font-size: 1.05rem; max-width: 60ch; }
.count { font-size: .92rem; color: var(--ink-2); }
.group { padding-bottom: 28px; }
.group-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin: 12px 0 14px; }
.group-count { display: inline-grid; place-items: center; min-width: 1.8em; height: 1.8em; padding: 0 .4em; border-radius: 999px; background: var(--line); font-size: .8rem; vertical-align: middle; }
.grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.empty { padding: 56px 16px; text-align: center; }

/* ---------- Card ---------- */
.card {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgb(15 23 42 / .06), 0 14px 32px rgb(15 23 42 / .1); }
.card-media { position: relative; display: block; aspect-ratio: 3 / 2; background: var(--line); }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media-empty { display: block; width: 100%; height: 100%; min-height: 160px; background: linear-gradient(135deg, var(--line), #f1f5f9); }
.badge { position: absolute; top: 12px; left: 12px; background: #fff; color: var(--ink); font-size: .78rem; font-weight: 700; padding: .25rem .6rem; border-radius: 999px; box-shadow: var(--shadow); }
.card-body { display: flex; flex-direction: column; gap: 4px; padding: 16px; flex: 1; }
.card-cat { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); margin: 0; }
.card-cat a { text-decoration: none; }
.card-title { font-size: 1.2rem; margin: 2px 0; }
.card-spec { font-weight: 600; margin: 0; }
.card-price { margin: 2px 0; font-size: 1.05rem; }
.card-price strong { font-size: 1.15rem; }
.card-loc { display: flex; align-items: center; gap: 6px; color: var(--ink-2); margin: 0 0 10px; }
.card-cta { margin-top: auto; }

/* ---------- Modal ---------- */
.modal { border: 0; padding: 0; margin: auto 0 0; width: 100%; max-width: 100%; max-height: 94dvh; border-radius: 20px 20px 0 0; background: var(--surface); color: var(--ink); }
.modal::backdrop { background: rgb(15 23 42 / .55); }
.modal[open] { animation: sheet-up .22s ease-out; }
@keyframes sheet-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-panel { position: relative; padding: 22px 18px calc(20px + env(safe-area-inset-bottom)); }
.modal-title { font-size: 1.35rem; margin: 0 40px 10px 0; }
.modal-close { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--bg); color: var(--ink); cursor: pointer; display: grid; place-items: center; }
body.modal-open { overflow: hidden; }

/* ---------- Form ---------- */
.lead-form { display: flex; flex-direction: column; gap: 12px; }
.lead-confirm { background: color-mix(in srgb, var(--brand) 8%, #fff); border: 1px solid color-mix(in srgb, var(--brand) 25%, #fff); padding: 12px 14px; border-radius: var(--radius-sm); font-size: .95rem; margin: 0; }
.lead-confirm:empty { display: none; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-weight: 600; font-size: .95rem; }
.field input, .field select {
  width: 100%; min-height: var(--tap); padding: .7rem .85rem; font: 16px/1.3 var(--font); color: var(--ink);
  background: #fff; border: 1.5px solid #cbd5e1; border-radius: var(--radius-sm); appearance: none;
}
.field select { background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 2.2rem; }
.field input:focus, .field select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
.input-group { display: flex; }
.input-prefix { display: grid; place-items: center; padding: 0 .8rem; border: 1.5px solid #cbd5e1; border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--bg); color: var(--ink-2); font-weight: 600; }
.input-group input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.field-error { color: var(--danger); font-size: .88rem; margin: 0; min-height: 0; }
.field-error:empty { display: none; }
.has-error input, .has-error select, .has-error .input-prefix { border-color: var(--danger); }
.form-alert { display: none; background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; padding: 12px 14px; border-radius: var(--radius-sm); font-weight: 600; }
.form-alert.is-visible { display: block; }
.form-note { font-size: .8rem; color: var(--ink-2); margin: 0; text-align: center; }
.spinner { display: none; width: 18px; height: 18px; border: 2.5px solid rgb(255 255 255 / .45); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.is-loading .spinner { display: inline-block; }
.is-loading { pointer-events: none; opacity: .85; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Project page ---------- */
.thanks { background: var(--ok-bg); color: var(--ok); border-bottom: 1px solid #a7f3d0; padding: 16px 0; }
.thanks-title { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; margin: 0 0 2px; }
.thanks-sub { margin: 0; color: #065f46; }
.project-head { padding-top: 22px; padding-bottom: 12px; }
.project-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--ink-2); font-weight: 600; }
.project-price { font-size: 1.15rem; margin: 8px 0 0; }
.project-price strong { font-size: 1.35rem; color: var(--brand); }
.section { padding-top: 22px; padding-bottom: 6px; }
.prose p { max-width: 70ch; }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0; }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.fact-wide { grid-column: 1 / -1; }
.fact dt { font-size: .8rem; color: var(--ink-2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.fact dd { margin: 2px 0 0; font-weight: 700; }
.highlights, .amenities, .loc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.highlights li { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius-sm); padding: 12px 14px; display: flex; flex-direction: column; }
.highlights span, .amenities small, .loc-list small { color: var(--ink-2); display: block; font-size: .92rem; }
.amenities { grid-template-columns: repeat(2, 1fr); }
.amenities li { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; }
.amenity-icon { font-size: 1.5rem; line-height: 1; }
.loc-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.loc-dist { flex: 0 0 auto; font-weight: 700; color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, #fff); padding: .2rem .6rem; border-radius: 999px; font-size: .9rem; }
.cta-band { text-align: center; padding-top: 32px; padding-bottom: 40px; }
.cta-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; max-width: 420px; margin: 12px auto 0; }

/* Gallery (scroll-snap = native swipe on touch) */
.gallery { position: relative; border-radius: var(--radius); overflow: hidden; background: #0b1220; }
.gallery-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none; overscroll-behavior-x: contain; }
.gallery-track::-webkit-scrollbar { display: none; }
/* Slide shape follows the cover photo (set by gallery.js as --gallery-ratio), capped so tall
   photos don't fill the whole screen. Every photo is shown in full (contain) over a blurred copy. */
.gallery-slide { position: relative; flex: 0 0 100%; margin: 0; scroll-snap-align: center; overflow: hidden;
  aspect-ratio: var(--gallery-ratio, 3 / 2); max-height: min(78vh, 760px); width: 100%; }
.gallery-slide .slide-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  filter: blur(22px) brightness(.75); transform: scale(1.15); }
.gallery-slide .slide-img { position: relative; width: 100%; height: 100%; object-fit: contain; }
.gallery-slide figcaption { position: absolute; left: 12px; bottom: 12px; background: rgb(0 0 0 / .55); color: #fff; font-size: .85rem; padding: .25rem .6rem; border-radius: 999px; }
.gallery-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgb(255 255 255 / .9); color: var(--ink); font-size: 1.8rem; line-height: 1; cursor: pointer; display: grid; place-items: center; box-shadow: var(--shadow); }
.gallery-prev { left: 10px; } .gallery-next { right: 10px; }
.gallery-nav[disabled] { opacity: .35; cursor: default; }
.gallery-bar { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 8px; align-items: center; }
.gallery-counter { background: rgb(0 0 0 / .55); color: #fff; font-size: .85rem; padding: .25rem .6rem; border-radius: 999px; }
.gallery-full { width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgb(0 0 0 / .55); color: #fff; font-size: 1.1rem; cursor: pointer; }
.gallery.is-fullscreen { position: fixed; inset: 0; z-index: 60; border-radius: 0; display: flex; align-items: center; }
.gallery.is-fullscreen .gallery-track { width: 100%; height: 100%; }
.gallery.is-fullscreen .gallery-slide { aspect-ratio: auto; height: 100%; max-height: none; }
.gallery.is-fullscreen .gallery-slide .slide-bg { display: none; }

/* Teaser (gated page) */
.teaser { display: grid; gap: 18px; padding-top: 20px; padding-bottom: 40px; }
.teaser-media { border-radius: var(--radius); overflow: hidden; aspect-ratio: 3 / 2; background: var(--line); }
.teaser-media img { width: 100%; height: 100%; object-fit: cover; }
.unlocks { background: var(--surface); border: 1px dashed #cbd5e1; border-radius: var(--radius-sm); padding: 12px 14px; }
.unlocks ul { margin: 6px 0 0; padding-left: 1.1rem; color: var(--ink-2); }
.card-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }

/* ---------- Footer ---------- */
.site-footer { background: #0f172a; color: #cbd5e1; margin-top: 24px; padding: 28px 0 calc(28px + env(safe-area-inset-bottom)); font-size: .92rem; }
.footer-inner { display: grid; gap: 14px; }
.footer-name { color: #fff; font-weight: 800; font-size: 1.05rem; margin: 0; }
.site-footer .muted { color: #94a3b8; }
.footer-contact { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.footer-contact a { text-decoration: none; color: #e2e8f0; }
.footer-disclaimer { font-size: .8rem; color: #94a3b8; border-top: 1px solid #1e293b; padding-top: 12px; margin: 0; }

/* ---------- Larger screens ---------- */
@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
  .stats-cta .btn { width: auto; }
  .header-call-text { display: inline; }
  .facts { grid-template-columns: repeat(3, 1fr); }
  .amenities { grid-template-columns: repeat(3, 1fr); }
  .cta-actions { flex-direction: row; justify-content: center; max-width: none; }
  .modal { margin: auto; max-width: 480px; border-radius: 20px; }
  .modal-panel { padding: 28px 28px 24px; }
}
@media (min-width: 960px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .hero-inner { padding-top: 96px; padding-bottom: 96px; }
  .teaser { grid-template-columns: 1.15fr 1fr; align-items: start; }
  .teaser-media { grid-column: 1; }
  .teaser-body { grid-column: 1; }
  .teaser-form { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 130px; }
  .footer-inner { grid-template-columns: 1fr auto; }
  .footer-disclaimer { grid-column: 1 / -1; }
  .loc-list { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- v2 additions ---------- */
.type-chips { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 4px; scrollbar-width: none; }
.type-chips::-webkit-scrollbar { display: none; }
.chip-count { font-size: .78rem; opacity: .7; margin-left: 2px; }
.gallery-thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: thin; }
.thumb { flex: 0 0 auto; width: 76px; height: 52px; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: var(--line); cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.is-active { border-color: var(--brand); }
.highlights li { font-weight: 600; }
.gallery-top { padding-top: 16px; }
.field textarea {
  width: 100%; min-height: 64px; padding: .65rem .85rem; font: 16px/1.4 var(--font); color: var(--ink);
  background: #fff; border: 1.5px solid #cbd5e1; border-radius: var(--radius-sm); resize: vertical;
}
.field textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
.has-error textarea { border-color: var(--danger); }
.optional { font-weight: 400; color: var(--ink-2); }
.btn-whatsapp { background: #25d366; color: #fff; }
.btn-whatsapp:hover { filter: brightness(1.05); }

/* Video slides: the whole video is visible on a dark background; it plays only when tapped. */
.gallery-slide.is-video { background: #000; }
.gallery-slide video.slide-img { display: block; background: #000; }
.thumb-video { background: #1f2937; display: grid; place-items: center; }
.thumb-play { color: #fff; font-size: 1.1rem; line-height: 1; }
.gallery.on-video .gallery-bar { top: 10px; bottom: auto; }

/* Country code + mobile number side by side */
.phone-row { display: grid; grid-template-columns: minmax(0, 8.5rem) minmax(0, 1fr); gap: 8px; align-items: end; }
.phone-row .field select { padding-right: 1.8rem; text-overflow: ellipsis; }
.phone-row + .field-error, .phone-row + .field-error + .field-error { margin-top: -6px; }
