/* Bercary responsive cover and CRM layout — 2026-11-20.
   Only the five Bercary covers and Alex/Sofia demos; independent mini-sites unchanged. */
:root{--bercary-global-header-height:110px}
@media (min-width:700px){
  /* Fill the available viewport below the shared Bercary header, but never clip content. */
  body.bercary-global-main[data-page="home"] .bercary-one,
  body.bercary-global-main[data-bercary-cover="service"] section.hero:first-of-type{
    box-sizing:border-box;
    min-height:max(470px,calc(100svh - var(--bercary-global-header-height)))!important;
    height:auto!important;
    display:flex!important;
    flex-direction:column;
    justify-content:center;
  }
  body.bercary-global-main[data-page="home"] .bercary-one-inner{flex:1;min-height:0;justify-content:space-between}
  body.bercary-global-main[data-bercary-cover="service"] .hero .container,
  body.bercary-global-main[data-bercary-cover="service"] .hero .wrap{width:100%}
  /* Prevent hero calls-to-action and images exceeding landscape tablet viewport. */
  body.bercary-global-main[data-bercary-cover="service"] .hero{padding-block:clamp(28px,4svh,58px)!important}
  body.bercary-global-main[data-bercary-cover="service"] .hero h1{max-width:870px}
}
@media (min-width:700px) and (max-height:650px){
 body.bercary-global-main[data-bercary-cover="service"] .hero{padding-block:20px!important}
 body.bercary-global-main[data-page="home"] .bercary-one-inner{padding-block:24px 18px!important}
}
/* On narrow portrait devices: content-led heights and correct image framing. */
@media(max-width:699px){
 body.bercary-global-main[data-page="home"] .bercary-one{
   height:auto!important;min-height:min(700px,calc(100svh - var(--bercary-global-header-height) + 90px))!important;
 }
 body.bercary-global-main[data-page="home"] .bercary-one-inner{padding-block:clamp(32px,6svh,66px) 24px!important}
 body.bercary-global-main[data-bercary-cover="service"] section.hero:first-of-type{
   height:auto!important;min-height:0!important;padding-block:clamp(34px,7svh,70px)!important;
 }
 body.bercary-global-main[data-bercary-cover="service"] .hero h1{font-size:clamp(28px,7.5vw,42px)!important;line-height:1.17!important}
}
/* Compact, synchronized-height Alex and Sofia demos on desktop. Internal lists scroll. */
@media (min-width:821px){
 body[data-bercary-crm="estate"] #demo .re-layout{grid-template-columns:minmax(0,340px) minmax(0,1fr)!important;align-items:stretch!important;gap:clamp(13px,2vw,24px)!important}
 body[data-bercary-crm="estate"] #demo .re-chat-panel,
 body[data-bercary-crm="estate"] #demo .re-crm-panel,
 body[data-bercary-crm="estate"] #demo .re-chat-panel .phone,
 body[data-bercary-crm="estate"] #demo .re-crm{
   height:clamp(440px,68svh,620px)!important;max-height:clamp(440px,68svh,620px)!important;min-height:0!important;box-sizing:border-box;
 }
 body[data-bercary-crm="estate"] #demo .re-chat-panel .phone{display:flex!important;flex-direction:column!important;overflow:hidden}
 body[data-bercary-crm="estate"] #demo .re-chat-panel .messages{flex:1!important;min-height:0!important;overflow-y:auto!important}
 body[data-bercary-crm="estate"] #demo .re-crm{overflow:hidden!important;display:flex;flex-direction:column}
 body[data-bercary-crm="estate"] #demo .re-appointments{flex:1!important;min-height:0!important;overflow-y:auto!important}
 body[data-bercary-crm="dental"] #demo .wrap.demo-wrap{grid-template-columns:minmax(0,320px) minmax(0,1fr)!important;row-gap:16px!important;align-items:start}
 body[data-bercary-crm="dental"] #demo .demo-wrap>.phone,
 body[data-bercary-crm="dental"] #demo .demo-wrap>.dental-crm{
   height:clamp(440px,68svh,620px)!important;max-height:clamp(440px,68svh,620px)!important;min-height:0!important;box-sizing:border-box;
 }
 body[data-bercary-crm="dental"] #demo .demo-wrap>.phone{display:flex;flex-direction:column;overflow:hidden}
 body[data-bercary-crm="dental"] #demo .phone .screen{flex:1!important;min-height:0!important;height:auto!important;overflow-y:auto!important}
 body[data-bercary-crm="dental"] #demo .demo-wrap>.dental-crm{overflow-y:auto!important;overscroll-behavior:contain}
}
/* Tablet portrait + phone: one panel at a time, no long stack. */
.bercary-crm-tabs{display:none}
@media(max-width:820px){
 .bercary-crm-tabs{display:flex;align-items:center;gap:7px;grid-column:1/-1;min-width:0;background:#eef3ee;border-radius:14px;padding:5px;margin:3px 0 12px}
 .bercary-crm-tabs button{flex:1;min-height:42px;padding:9px 15px;border:0;border-radius:10px;background:transparent;color:#315548;font:600 13px/1.25 'Work Sans',Arial,sans-serif;cursor:pointer}
 .bercary-crm-tabs button[aria-selected="true"]{background:#176b50;color:#fff;box-shadow:0 2px 8px #143d2922}
 .bercary-crm-tabs button:focus-visible{outline:3px solid #e89373;outline-offset:2px}
 body[data-bercary-crm="estate"] #demo .re-layout{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:0!important}
 body[data-bercary-crm="estate"] #demo .re-chat-panel,
 body[data-bercary-crm="estate"] #demo .re-crm-panel{grid-column:1!important;min-width:0}
 body[data-bercary-crm="estate"] #demo .re-chat-panel:not(.bercary-crm-visible),
 body[data-bercary-crm="estate"] #demo .re-crm-panel:not(.bercary-crm-visible){display:none!important}
 body[data-bercary-crm="estate"] #demo .re-chat-panel .phone{height:clamp(430px,67svh,570px)!important;max-height:clamp(430px,67svh,570px)!important;display:flex!important;flex-direction:column!important;overflow:hidden}
 body[data-bercary-crm="estate"] #demo .re-chat-panel .messages{min-height:0!important;flex:1;overflow-y:auto!important}
 body[data-bercary-crm="estate"] #demo .re-crm{height:clamp(430px,67svh,570px)!important;max-height:clamp(430px,67svh,570px)!important;overflow:hidden!important;display:flex;flex-direction:column}
 body[data-bercary-crm="estate"] #demo .re-appointments{min-height:0!important;flex:1!important;overflow-y:auto!important;max-height:none!important}
 body[data-bercary-crm="dental"] #demo .wrap.demo-wrap{display:grid!important;grid-template-columns:minmax(0,1fr)!important;grid-template-rows:auto auto auto!important;gap:14px!important}
 body[data-bercary-crm="dental"] #demo .demo-wrap>.dental-demo-intro{grid-column:1!important;grid-row:1!important}
 body[data-bercary-crm="dental"] #demo .bercary-crm-tabs{grid-row:2!important}
 body[data-bercary-crm="dental"] #demo .demo-wrap>.phone,
 body[data-bercary-crm="dental"] #demo .demo-wrap>.dental-crm{grid-column:1!important;grid-row:3!important;justify-self:center!important;align-self:start!important;min-width:0}
 body[data-bercary-crm="dental"] #demo .demo-wrap>.phone:not(.bercary-crm-visible),
 body[data-bercary-crm="dental"] #demo .demo-wrap>.dental-crm:not(.bercary-crm-visible){display:none!important}
 body[data-bercary-crm="dental"] #demo .demo-wrap>.phone{width:min(100%,390px)!important;height:clamp(430px,67svh,570px)!important;max-height:clamp(430px,67svh,570px)!important;display:flex;flex-direction:column;overflow:hidden}
 body[data-bercary-crm="dental"] #demo .phone .screen{flex:1!important;min-height:0!important;height:auto!important;overflow-y:auto!important}
 body[data-bercary-crm="dental"] #demo .demo-wrap>.dental-crm{width:100%!important;max-width:650px!important;height:clamp(430px,67svh,570px)!important;max-height:clamp(430px,67svh,570px)!important;min-height:0!important;overflow-y:auto!important}
}
@media(max-width:420px){.bercary-crm-tabs button{font-size:12px;padding-inline:6px}}
@media(prefers-reduced-motion:reduce){.bercary-crm-tabs *{scroll-behavior:auto!important}}

/* Real estate CRM: accessible scrolling for mouse wheel, touchpad and touch, with compact visible content. */
@media(min-width:801px){
 body .re-crm-panel,body .re-crm{min-height:0!important;max-height:min(680px,calc(100dvh - 108px))!important;height:min(680px,calc(100dvh - 108px))!important}
 body .re-crm{overflow-y:auto!important;overflow-x:hidden!important;overscroll-behavior-y:contain;scrollbar-width:thin;touch-action:pan-y;-webkit-overflow-scrolling:touch}
 body .re-crm .re-prospects,body .re-crm .re-appointments{overflow:visible!important;max-height:none!important;min-height:0!important;flex-shrink:0!important}
}
@media(max-width:800px){body .re-crm{overflow-y:auto!important;max-height:min(640px,78dvh)!important;min-height:0!important;touch-action:pan-y;-webkit-overflow-scrolling:touch}body .re-appointments{overflow:visible!important;max-height:none!important}}

/* 2026-11-24 — Match the WhatsApp mock phone and CRM heights exactly.
   Older rules below 821px used a different viewport formula for only the CRM.
   Keep ONE sizing variable for each breakpoint and allow internal scrolling. */
@media (min-width:821px) {
  body[data-bercary-crm="estate"] #demo .re-layout {
    --bercary-demo-height:clamp(440px,68svh,620px);
    align-items:stretch!important;
  }
  body[data-bercary-crm="estate"] #demo .re-chat-panel,
  body[data-bercary-crm="estate"] #demo .re-crm-panel,
  body[data-bercary-crm="estate"] #demo .re-chat-panel>.phone,
  body[data-bercary-crm="estate"] #demo .re-crm-panel>.re-crm {
    height:var(--bercary-demo-height)!important;
    min-height:0!important;
    max-height:var(--bercary-demo-height)!important;
    box-sizing:border-box!important;
  }
}
@media (max-width:820px) {
  body[data-bercary-crm="estate"] #demo .re-layout {
    --bercary-demo-height:clamp(430px,67svh,570px);
  }
  body[data-bercary-crm="estate"] #demo .re-chat-panel>.phone,
  body[data-bercary-crm="estate"] #demo .re-crm-panel>.re-crm {
    height:var(--bercary-demo-height)!important;
    min-height:0!important;
    max-height:var(--bercary-demo-height)!important;
    box-sizing:border-box!important;
  }
}
body[data-bercary-crm="estate"] #demo .re-crm-panel>.re-crm {
  overflow-y:auto!important;
  overflow-x:hidden!important;
  scrollbar-width:thin;
  overscroll-behavior-y:contain;
  touch-action:pan-y;
  -webkit-overflow-scrolling:touch;
}
body[data-bercary-crm="estate"] #demo .re-crm .re-prospects,
body[data-bercary-crm="estate"] #demo .re-crm .re-appointments {
  overflow:visible!important;
  max-height:none!important;
  min-height:0!important;
  flex-shrink:0!important;
}
/* Dental demo: same phone and CRM height, keeping both contents scrollable. */
@media (min-width:821px) {
  body[data-bercary-crm="dental"] #demo .demo-wrap {
    --bercary-demo-height:clamp(440px,68svh,620px);
  }
}
@media (max-width:820px) {
  body[data-bercary-crm="dental"] #demo .demo-wrap {
    --bercary-demo-height:clamp(430px,67svh,570px);
  }
}
body[data-bercary-crm="dental"] #demo .demo-wrap>.phone,
body[data-bercary-crm="dental"] #demo .demo-wrap>.dental-crm {
  height:var(--bercary-demo-height)!important;
  max-height:var(--bercary-demo-height)!important;
  min-height:0!important;
  box-sizing:border-box!important;
}
body[data-bercary-crm="dental"] #demo .demo-wrap>.dental-crm {
  overflow-y:auto!important;
  overflow-x:hidden!important;
  touch-action:pan-y;
  overscroll-behavior-y:contain;
}
