:root {
  --bg: #f8f4ef;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #fff;
  --text: #242423;
  --muted: #6b645d;
  --accent: #b08c57;
  --accent-soft: #f0e5d8;
  --border: rgba(36, 36, 35, 0.12);
  --shadow: 0 24px 60px rgba(18, 18, 18, 0.06);
  --radius: 26px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: radial-gradient(circle at top left, rgba(176, 140, 87, 0.08), transparent 24%),
              linear-gradient(180deg, #fdfaf6 0%, #f8f4ef 100%);
  color: var(--text);
  line-height: 1.7;
}

/* Prevent accidental horizontal scroll on small devices caused by fixed elements */
html, body {
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

button,
a {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
}

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(36, 36, 35, 0.08);
  transition: padding 0.3s ease, box-shadow 0.3s ease;
}

.header.shrink {
  padding: 0.6rem 0;
  box-shadow: 0 14px 40px rgba(18, 18, 18, 0.08);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-mark,
.brand-mark-footer {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-weight: 700;
}

.brand-mark-footer {
  width: 48px;
  height: 48px;
}

.brand-title {
  margin: 0;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.2rem;
  letter-spacing: 0.2em;
}

.brand-subtitle {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.nav {
  flex: 1;
  position: relative; /* anchor mobile menu below header */
}

.nav-list {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
}

.nav-link {
  position: relative;
  color: var(--text);
  font-weight: 500;
  transition: color 0.25s ease;
}

.nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -5px;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.25s ease;
}

.nav-link:hover::after,
.nav-link:focus::after {
  width: 100%;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-toggle {
  display: none;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0.6rem;
  gap: 6px;
  flex-direction: column;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 999px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  padding: 0.95rem 1.7rem;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--text);
  color: #fff;
  box-shadow: 0 18px 40px rgba(36, 36, 35, 0.16);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(36, 36, 35, 0.16);
}

.btn-tertiary {
  background: rgba(176, 140, 87, 0.1);
  color: var(--text);
}

.hero {
  min-height: 92vh;
  position: relative;
  display: grid;
  align-items: center;
  padding: 6rem 0 3rem;
  background-image: linear-gradient(180deg, rgba(248, 244, 239, 0.82), rgba(248, 244, 239, 0.82)),
    url('images/hero.jpg');
  background-size: cover;
  background-position: center;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.16), rgba(36,36,35,0.1));
}

.hero-content {
  position: relative;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2rem;
  align-items: start;
}

.hero-copy {
  max-width: 640px;
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 1rem;
  color: var(--accent);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.hero h1,
.section-header h2,
.about h2,
.appointment h2,
.contact h2,
.experts h2,
.testimonials h2 {
  font-family: 'Cormorant Garamond', serif;
  margin: 0;
  font-size: clamp(2.6rem, 4vw, 4.4rem);
  letter-spacing: 0.03em;
  line-height: 1.05;
}

.hero-copy p,
.about-copy p,
.feature-card p,
.service-copy p,
.testimonial-card p,
.contact-copy p,
.appointment-copy p {
  color: var(--muted);
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem;
}

.hero-info {
  display: grid;
  gap: 1rem;
}

.hero-card {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(36, 36, 35, 0.08);
  border-radius: var(--radius);
  padding: 1.6rem;
  box-shadow: var(--shadow);
}

.hero-card h3 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

.hero-card p {
  margin: 0;
}

.accent-card {
  background: rgba(176, 140, 87, 0.1);
}

.section {
  padding: 5rem 0;
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-header h2 {
  font-size: clamp(2rem, 3vw, 3rem);
}

.grid-two {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2.5rem;
  align-items: center;
}

.about-image,
.map-card,
.appointment-copy,
.about-copy,
.contact-copy,
.appointment-form {
  border-radius: var(--radius);
}

.about-image img,
.team-card img,
.service-card img,
.gallery-item img,
.testimonial-author img {
  border-radius: 24px;
  object-fit: cover;
}

.about-image {
  overflow: hidden;
}

.about-copy {
  display: grid;
  gap: 1.6rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 1.2rem;
  box-shadow: 0 18px 40px rgba(18, 18, 18, 0.05);
}

.stat-card h3 {
  margin: 0;
  font-size: 2rem;
}

.stat-card p {
  margin: 0.6rem 0 0;
  color: var(--muted);
}

.services-grid,
.features-grid,
.gallery-grid,
.team-grid {
  display: grid;
  gap: 1.8rem;
}

.services-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.service-card {
  border-radius: 30px;
  overflow: hidden;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, border-color 0.3s ease;
  border: 1px solid transparent;
}

.service-card:hover {
  transform: translateY(-8px);
  border-color: rgba(176, 140, 87, 0.18);
}

.service-card img {
  width: 100%;
  height: 240px;
  object-fit: contain; /* show full image without cropping */
  object-position: center;
  background: rgba(255,255,255,0.98);
}

.service-copy {
  padding: 1.8rem;
  display: grid;
  gap: 1rem;
}

.service-copy h3 {
  margin: 0;
}

.price {
  margin: 0;
  font-weight: 600;
  color: var(--accent);
}

.features-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.feature-card {
  padding: 2rem;
  background: var(--surface-strong);
  border-radius: 28px;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-6px);
}

.feature-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(176, 140, 87, 0.12);
  font-size: 1.4rem;
  margin-bottom: 1.2rem;
}

.gallery-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  cursor: pointer;
  padding: 0;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 0.85;
  transition: transform 0.4s ease;
}

.gallery-item:hover img {
  transform: scale(1.06);
}

.gallery-item span {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  z-index: 1;
  color: #fff;
  text-shadow: 0 14px 30px rgba(0, 0, 0, 0.24);
  font-weight: 600;
}

.team-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.team-card {
  background: var(--surface-strong);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(18,18,18,0.06);
  transition: transform 0.28s ease, box-shadow 0.28s ease;
  display: flex;
  flex-direction: column;
  height: 480px; /* increased card height to show full portraits */
}

.team-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 30px 60px rgba(18,18,18,0.12);
}

.team-figure {
  width: 100%;
  /* give more vertical room for full portraits */
  min-height: 300px;
  height: 62%;
  overflow: hidden;
  background: var(--accent-soft); /* subtle premium background when using contain */
  display: grid;
  place-items: center;
  padding: 0.8rem; /* breathing room so contain doesn't touch edges */
  aspect-ratio: 3 / 4;
}

.team-figure img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain; /* ensure full portrait is visible without cropping */
  object-position: center center;
  transition: none;
  display: block;
}

.team-meta {
  padding: 1.2rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1 1 auto;
}

.team-meta h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-meta p.role {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.team-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: auto;
}

.rating {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
}

.btn-sm {
  padding: 0.55rem 0.9rem;
  font-size: 0.92rem;
  border-radius: 999px;
}

/* Responsive adjustments for team cards */
@media (max-width: 1024px) {
  .team-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .team-card { height: 460px; }
}

@media (max-width: 560px) {
  .team-grid { grid-template-columns: 1fr; }
  .team-card { height: 420px; }
  .team-figure { height: 60%; }
}

.team-copy {
  padding: 1.5rem;
}

.team-copy h3 {
  margin: 0 0 0.35rem;
}

.team-copy p {
  margin: 0 0 1rem;
  color: var(--muted);
}

.social-icons {
  display: flex;
  gap: 0.7rem;
}

.social-icons a {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(36, 36, 35, 0.14);
  color: var(--text);
  background: transparent;
  overflow: hidden;
}

.social-icons a svg,
.social-footer a svg {
  width: 18px;
  height: 18px;
  display: block;
}

.social-icons a.instagram,
.social-footer a.instagram {
  border: none;
  padding: 6px;
  color: #fff;
}

.social-icons a.whatsapp,
.social-footer a.whatsapp {
  border: none;
  padding: 6px;
  background: #25D366;
  color: #fff;
}

.social-footer a.instagram {
  background: linear-gradient(45deg,#feda75,#fa7e1e,#d62976,#962fbf,#4f5bd5);
}

.testimonial-wrapper {
  position: relative;
  display: grid;
  align-items: center;
}

.testimonial-slider {
  overflow: hidden;
}

.testimonial-card {
  display: none;
  padding: 2rem;
  background: var(--surface-strong);
  border-radius: 30px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.testimonial-card.active {
  display: block;
}

.testimonial-card p {
  font-size: 1.05rem;
}

.testimonial-author {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.8rem;
}

.testimonial-author img {
  width: 62px;
  height: 62px;
}

.slider-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.9);
  box-shadow: var(--shadow);
  cursor: pointer;
  color: var(--text);
}

.prev {
  left: -16px;
}

.next {
  right: -16px;
}

.appointment-form {
  background: var(--surface-strong);
  padding: 2rem;
  border-radius: 30px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

/* Form grid tweaks for consistent spacing and responsive layout */
.appointment-grid { align-items: start; gap: 2.4rem; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.form-grid label { display: block; }
.form-grid .full-width { grid-column: 1 / -1; }

.form-actions { display: flex; justify-content: center; margin-top: 1.1rem; }
.btn-lg { padding: 0.95rem 1.6rem; font-size: 1rem; border-radius: 999px; box-shadow: 0 18px 40px rgba(36,36,35,0.12); }

/* Ensure the primary button is prominent and responsive */
.appointment-form .btn-primary { background: var(--text); color: #fff; }

@media (max-width: 820px) {
  .header-inner { flex-wrap: nowrap; align-items: center; min-height: 64px; }
  .form-grid { grid-template-columns: 1fr; }
  .appointment-grid { grid-template-columns: 1fr; }
  .form-actions { justify-content: stretch; }
  .form-actions .btn { width: 100%; }
  /* Mobile navbar: show hamburger, collapse links into vertical panel */
  .nav { flex: 0 0 auto; }
  .nav-toggle { display: inline-flex; }
  .nav-list {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%; /* placed below the header area */
    background: rgba(255,255,255,0.98);
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0.6rem 1rem 1.2rem;
    margin: 0;
    box-shadow: 0 18px 40px rgba(18,18,18,0.06);
    border-bottom: 1px solid rgba(36,36,35,0.06);
    transform-origin: top right;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.22s ease, transform 0.22s ease;
  }
  .nav-list li { padding: 0.55rem 0; }
  .nav-list a { display: block; padding: 0.55rem 0.5rem; }
  .nav.open .nav-list {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }
  /* Ensure brand/logo stays above the mobile menu */
  .brand { z-index: 30; position: relative; }
  .nav-list { z-index: 22; }
  .nav-toggle { z-index: 32; }
  .header-actions { gap: 0.5rem; }
  /* hide the header CTA visually on small screens; JS will move it into the menu */
  .header-actions .btn-primary { display: none !important; }
  .btn { padding: 0.6rem 1rem; }
}

/* Ensure very small handsets don't overflow and logo remains visible */
@media (max-width: 420px) {
  .brand-title { font-size: 1rem; }
  .brand-mark { width: 44px; height: 44px; font-size: 1.1rem; }
  .header-inner { gap: 0.6rem; padding: 0.6rem 0; }
  .nav-list { padding-left: 0.6rem; padding-right: 0.6rem; }
  .btn-primary { padding: 0.55rem 0.9rem; }
}

/* Contact / Map styles */
.contact-grid { display: grid; grid-template-columns: 1fr 460px; gap: 2rem; align-items: start; }
.map-embed { background: var(--border); height: 380px; border-radius: 18px; overflow: hidden; }
.map-embed iframe { width:100%; height:100%; border:0; }
.contact-panel { padding: 0.4rem 0; }
.contact-blocks { display: grid; gap: 0.9rem; margin: 1rem 0 1.4rem; }
.contact-item { display:flex; gap:0.8rem; align-items:flex-start; }
.contact-icon { color: var(--muted); flex:0 0 22px; }
.contact-actions { display:flex; gap:1rem; align-items:center; }
.contact-actions .social-icons { margin-left: auto; }
.contact-actions .social-icons a img { width:32px; height:32px; }

@media (max-width: 1024px) {
  .contact-grid { grid-template-columns: 1fr; }
  .map-embed { height: 300px; }
}

/* Footer styles */
.footer { padding: 3rem 0 1.2rem; background: linear-gradient(180deg, rgba(248,244,239,0.02), transparent); }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(3, minmax(0,1fr)); gap: 2rem; align-items:start; }
.footer h4 { margin: 0 0 0.8rem; }
.footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.footer a { color: var(--text); }
.social-footer a img { width:28px; height:28px; }
.footer-note { text-align:center; margin-top:1.2rem; color:var(--muted); font-size:0.95rem; }

@media (max-width: 820px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; }
  .map-embed { height: 260px; }
}

.appointment-copy {
  display: grid;
  gap: 1.5rem;
}

.appointment-details {
  display: grid;
  gap: 1rem;
}

.appointment-details div {
  background: rgba(255,255,255,0.86);
  border: 1px solid rgba(36, 36, 35, 0.08);
  border-radius: 22px;
  padding: 1rem;
}

.form-grid {
  display: grid;
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.45rem;
  color: #4e4a43;
  font-size: 0.95rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(36, 36, 35, 0.14);
  border-radius: 16px;
  padding: 0.95rem 1rem;
  background: #fff;
  font-size: 0.95rem;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(176, 140, 87, 0.6);
  box-shadow: 0 0 0 4px rgba(176, 140, 87, 0.1);
}

.full-width {
  grid-column: 1 / -1;
}

.form-feedback {
  margin-top: 1rem;
  color: var(--accent);
  min-height: 1.5rem;
}

.contact-details {
  display: grid;
  gap: 1rem;
}

.contact-details div {
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(36, 36, 35, 0.08);
  border-radius: 22px;
  padding: 1rem;
}

.map-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 244, 239, 0.92));
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  min-height: 420px;
  display: grid;
  place-items: center;
}

.map-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 24px;
  border: 1px dashed rgba(36, 36, 35, 0.18);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 1.05rem;
  text-align: center;
  padding: 2rem;
}

.footer {
  padding: 3rem 0 1.5rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, minmax(0, 1fr));
  gap: 2rem;
  border-top: 1px solid rgba(36, 36, 35, 0.08);
  padding-top: 2rem;
}

.footer h4 {
  margin: 0 0 1rem;
}

.footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.footer p,
.footer a {
  color: var(--muted);
}

.social-footer {
  display: flex;
  gap: 0.8rem;
  margin-top: 1rem;
}

.social-footer a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(176, 140, 87, 0.1);
  color: var(--text);
}

.footer-note {
  text-align: center;
  margin-top: 1.8rem;
  color: var(--muted);
}

.chatbot-shell {
  position: fixed;
  right: 12px; /* safe margin from edge */
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 9999; /* high but not extreme; keep stacking sensible */
  display: block;
  gap: 0.6rem;
  pointer-events: auto;
  will-change: transform;
}

.chatbot-button,
.floating-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 20px 40px rgba(18, 18, 18, 0.18);
  transition: transform 0.2s ease;
}

.chatbot-button:hover,
.floating-btn:hover {
  transform: translateY(-2px);
}

.chatbot-window {
  position: fixed; /* fixed to avoid parent clipping and ensure viewport containment */
  right: 12px;
  bottom: calc(74px + env(safe-area-inset-bottom, 12px)); /* open above the circular button */
  width: min(420px, calc(100vw - 24px));
  max-width: 420px;
  max-height: calc(100dvh - 96px); /* responsive to modern mobile viewports */
  background: rgba(255, 255, 255, 0.98);
  border-radius: 18px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px) scale(0.995);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 120px;
}

.chatbot-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0.9rem 0.5rem;
  background: linear-gradient(135deg, rgba(176, 140, 87, 0.12), transparent);
  position: sticky; /* keep header visible when body scrolls */
  top: 0;
  z-index: 8;
}

.chatbot-header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.chatbot-header p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.close-chat {
  border: none;
  background: rgba(36,36,35,0.04);
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(18,18,18,0.06);
  position: absolute;
  right: 12px;
  top: 10px;
  transition: background 0.18s ease, transform 0.12s ease;
  z-index: 10; /* ensure it's above chat content */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.close-chat:hover {
  background: rgba(36,36,35,0.08);
  transform: translateY(-1px);
}

.chatbot-body { }

.bot-message,
.user-message {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.45rem;
}

.bot-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(176, 140, 87, 0.16);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  flex: 0 0 46px;
}

.message-content {
  max-width: 78%;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,244,239,0.95));
  border: 1px solid rgba(36, 36, 35, 0.06);
  border-radius: 18px;
  padding: 0.9rem 1rem;
  color: var(--text);
  box-shadow: 0 10px 30px rgba(18,18,18,0.06);
  font-size: 0.97rem;
  line-height: 1.45;
  word-wrap: break-word;
}

.user-message {
  flex-direction: row-reverse;
}

.user-message .message-content {
  background: var(--text);
  color: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 18px 40px rgba(18,18,18,0.18);
}

/* Typing indicator styling when bot shows 'Typing...' */
.message-content.typing {
  font-style: italic;
  opacity: 0.9;
}

/* Ensure messages are comfortable on small screens */
@media (max-width: 480px) {
  .message-content { font-size: 0.95rem; max-width: 72%; }
  .bot-avatar { width: 40px; height: 40px; flex: 0 0 40px; }
}

/* Improve placement and visibility on small screens and when on-screen keyboards appear */
@media (max-width: 640px) {
  .chatbot-shell {
    right: 12px;
    bottom: calc(env(safe-area-inset-bottom, 12px));
  }

  .chatbot-window {
    right: 12px;
    left: 12px;
    width: auto;
    max-width: calc(100% - 24px);
    bottom: calc(74px + env(safe-area-inset-bottom, 0px));
    max-height: calc(100vh - 160px);
  }
}

/* Fallback for older browsers: ensure chat remains visible if safe-area variables are unavailable */
@supports not (bottom: env(safe-area-inset-bottom)) {
  .chatbot-shell { bottom: 24px; }
  .chatbot-window { bottom: 68px; }
}

.chatbot-quick-replies {
  display: grid;
  gap: 0.4rem;
  padding: 0.45rem 0.7rem 0.45rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  justify-items: stretch;
  background: transparent;
  z-index: 4; /* below header, above messages */
  max-height: 112px; /* prevent quick actions from growing too tall */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.chatbot-quick-replies button {
  background: rgba(36, 36, 35, 0.04);
  border: 1px solid rgba(36, 36, 35, 0.08);
  color: var(--text);
  border-radius: 12px;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
  height: 36px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Ensure quick-action buttons don't overlap the close button */
.chatbot-quick-replies { padding-right: 1.6rem; }

.chatbot-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.7rem 0.8rem 0.8rem;
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255,255,255,0.96));
  z-index: 9; /* above messages and quick actions */
  border-top: 1px solid rgba(36,36,35,0.04);
}

.chatbot-form input {
  flex: 1;
  border-radius: 999px;
  border: 1px solid rgba(36, 36, 35, 0.12);
  padding: 0.7rem 0.9rem;
  font-size: 0.95rem;
}

.chatbot-form button {
  border-radius: 999px;
  padding: 0.7rem 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 0.95rem;
  min-width: 56px;
}

.chatbot-body {
  display: block;
  gap: 0.6rem;
  padding: 0.6rem 0.9rem 1.2rem; /* extra bottom padding so last message isn't hidden behind composer */
  overflow-y: auto;
  flex: 1 1 auto; /* allow the body to take the remaining height */
  min-height: 0; /* enables proper flex child scrolling */
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* Make sure the quick actions area uses minimal space on very small screens */
@media (max-width: 420px) {
  .chatbot-quick-replies { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 110px; padding: 0.5rem; }
  .chatbot-quick-replies button { height: 36px; padding: 0.4rem 0.55rem; font-size: 0.88rem; }

/* Mobile footer improvements */
@media (max-width: 560px) {
  .footer { padding: 2rem 0 1rem; }
  .footer-grid { grid-template-columns: 1fr; gap: 1rem; }
  .footer h4 { margin-bottom: 0.5rem; }
  .social-footer { margin-top: 0.6rem; }
  .social-footer a { width: 36px; height: 36px; }
  .footer-note { font-size: 0.9rem; }
}

/* Prevent maps or large media from overflowing on small screens */
iframe, .map-embed iframe { max-width: 100%; width: 100%; }

/* Global card responsiveness: force grids to reflow on small widths */
@media (max-width: 820px) {
  .services-grid { grid-template-columns: 1fr; }
  .experts-grid { grid-template-columns: 1fr; }
  .services .service-card { grid-template-columns: 1fr; }
}

/* Typography scaling for mobile */
h1 { font-size: clamp(1.6rem, 3.6vw, 2.8rem); }
h2 { font-size: clamp(1.15rem, 2.8vw, 1.8rem); }
p { font-size: clamp(0.95rem, 1.8vw, 1rem); }
  .chatbot-window { right: 12px; left: 12px; max-height: calc(100vh - 110px); }
  .chatbot-form { padding: 0.6rem 0.8rem; }
}

@media (min-width: 900px) {
  .chatbot-quick-replies { grid-template-columns: repeat(3, minmax(0, 1fr)); max-height: 160px; }
  .chatbot-quick-replies button { height: 42px; font-size: 0.95rem; }
}

.back-to-top {
  position: fixed;
  right: 1.5rem;
  bottom: 7rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--text);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-4px);
}

.floating-actions {
  position: fixed;
  left: 1.5rem;
  bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  z-index: 30;
}

/* Final strong mobile override: ensure chatbot is a vertical fixed panel and cannot collapse into a single line */
@media (max-width: 768px) {
  .chatbot-shell {
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
    width: calc(100vw - 20px) !important;
    max-width: 420px !important;
    z-index: 9999 !important;
    pointer-events: auto;
  }

  .chatbot-window {
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    width: calc(100vw - 20px) !important;
    max-width: 420px !important;
    height: min(80dvh, 680px) !important;
    min-height: 400px !important;
    max-height: calc(100dvh - 88px) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    border-radius: 12px !important;
    box-shadow: var(--shadow) !important;
  }

  .chatbot-window.open { opacity: 1 !important; pointer-events: auto !important; }

  .chatbot-header {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex: 0 0 56px !important;
    min-height: 56px !important;
    padding: 10px 12px !important;
  }

  .chatbot-quick-replies {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.4rem !important;
    padding: 6px 10px !important;
    max-height: 120px !important;
    overflow-y: auto !important;
    background: transparent !important;
  }

  .chatbot-quick-replies button {
    width: 100% !important;
    min-width: 0 !important;
    height: 38px !important;
    padding: 0 8px !important;
    font-size: 0.92rem !important;
  }

  .chatbot-body {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 8px 10px !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .chatbot-body::after { content: '' ; display: block; height: calc(56px + env(safe-area-inset-bottom)); }

  .chatbot-form {
    display: flex !important;
    gap: 0.5rem !important;
    padding: 8px 10px !important;
    flex: 0 0 auto !important;
    position: sticky !important;
    bottom: 0 !important;
    background: rgba(255,255,255,0.98) !important;
    z-index: 15 !important;
  }

  .chatbot-form input { flex: 1 1 auto !important; min-width: 0 !important; }
  .chatbot-form button { flex: 0 0 auto !important; }

  .close-chat { z-index: 30 !important; }

  /* ensure no parent causes nowrap or inline behaviour */
  .chatbot-shell, .chatbot-window, .chatbot-header, .chatbot-quick-replies, .chatbot-body, .chatbot-form { white-space: normal !important; }
}

.floating-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: #fff;
  color: var(--text);
  display: grid;
  place-items: center;
  box-shadow: 0 22px 45px rgba(18, 18, 18, 0.12);
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(18, 18, 18, 0.82);
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
  z-index: 40;
}

.lightbox.open {
  opacity: 1;
  visibility: visible;
}

.lightbox img {
  max-width: 92%;
  max-height: 88%;
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.lightbox-close {
  position: absolute;
  top: 1.4rem;
  right: 1.4rem;
  border: none;
  background: rgba(255,255,255,0.92);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
}

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.delay-1 { transition-delay: 0.15s; }
.delay-2 { transition-delay: 0.3s; }
.delay-3 { transition-delay: 0.45s; }
.delay-4 { transition-delay: 0.6s; }
.delay-5 { transition-delay: 0.75s; }

@media (max-width: 1024px) {
  .services-grid,
  .features-grid,
  .gallery-grid,
  .team-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

@media (max-width: 820px) {
  .header-inner {
    flex-wrap: wrap;
  }

  .nav {
    position: fixed;
    inset: 72px 0 auto 0;
    background: rgba(255,255,255,0.96);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    z-index: 18;
    padding: 1.5rem 0;
  }

  .nav.open {
    transform: translateY(0);
  }

  .nav-list {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
    padding: 0 1.5rem;
  }

  .nav-toggle {
    display: flex;
  }

  .hero {
    padding-top: 5rem;
  }

  .services-grid,
  .features-grid,
  .gallery-grid,
  .team-grid {
    grid-template-columns: 1fr;
  }

  .testimonial-wrapper {
    padding: 0 1rem;
  }

  .slider-button {
    display: none;
  }

  .chatbot-shell {
    right: 1rem;
    bottom: 7.5rem; /* lift a bit to avoid overlapping mobile nav */
    z-index: 99999;
  }

  .floating-actions {
    left: 1rem;
    bottom: 7rem;
  }
}

@media (max-width: 560px) {
  .header-inner {
    padding: 0.75rem 0;
  }

  .brand-title {
    font-size: 1rem;
  }

  .hero h1 {
    font-size: 2.6rem;
  }

  .hero-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    width: 100%;
  }

  .appointment-form,
  .contact-copy,
  .map-card {
    padding: 1.6rem;
  }

  .testimonials .section-header,
  .gallery .section-header,
  .experts .section-header {
    margin-bottom: 2rem;
  }
}
