/* mobile.css — tablet + phone. Phone layout follows the reference doctor site: photo first, centred copy,
   full-width buttons, 2-col gallery, stacked sections. On phones the nav lives in a fixed bottom tab bar. */

/* ---------------- Small desktop / tablet landscape ---------------- */
@media (max-width: 980px) {
  .foot-grid { grid-template-columns: 1fr 1fr; gap: 2.2rem 2rem; }
  .svc-grid { grid-template-columns: repeat(2, 1fr); }
  .facts-grid { grid-template-columns: repeat(2, 1fr); }
  .fact:nth-child(3) { border-inline-start: 0; }
  .fact:nth-child(n+3) { border-top: 1px solid rgba(255, 255, 255, .22); }
  .rail, .rail--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chambers { grid-template-columns: 1fr; }
  .posts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cases--n1 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc { grid-template-columns: 1fr; }
  .aside { position: static; }
}

/* 7 menu items + language switch: keep the teal bar on one line between the hamburger breakpoint and full desktop width */
@media (min-width: 861px) and (max-width: 1100px) {
  .nav { gap: .85rem; }
  .nav a:not(.btn), html[lang="en"] .nav a:not(.btn) { white-space: nowrap; font-size: .86rem; letter-spacing: 0; }
  .nav .lang-switch a { padding-inline: .7rem; }
}

/* ---------------- Tablet portrait: nav collapses, layouts stack ---------------- */
@media (max-width: 860px) {
  body { font-size: 1.0625rem; }
  :root { --btn-r: 999px; --header-h: 64px; }
  .site-header { position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(40, 34, 98, .08); }
  .header-in { min-height: var(--header-h); }
  .brand-mark img { width: 52px; height: 52px; }
  .bb-short, .bb-line:not(.bb-line--phone) { display: none; }
  .bb-trail { display: none; }
  .bb-name { font-size: 1.05rem; margin: 0 0 .1rem; line-height: 1.3; }
  .bb-line { font-size: .8rem; line-height: 1.35; }
  .header-in { padding-block: .55rem; }
  .call-txt small { display: none; }
  .call-txt strong { font-size: 1.1rem; }
  .call-ico { width: 38px; height: 38px; }
  .nav-toggle { display: block; }
  .nav-bar { position: fixed; top: var(--header-h); left: 0; right: 0; z-index: 99; display: none; box-shadow: var(--shadow); }
  .nav-bar.open { display: block; }
  .nav { flex-direction: column; align-items: stretch; gap: 0; padding: .4rem 0 1.1rem; }
  .nav a:not(.btn) { padding: .85rem 0; border-bottom: 1px solid rgba(255, 255, 255, .25); }
  .nav .lang-switch { align-self: flex-start; margin: 1rem 0 0; }

  .hero { padding: 2.5rem 0 4rem; }
  .hero-grid, .about-grid, .sched-grid, .appt-grid, .contact-grid { grid-template-columns: 1fr; gap: 2.2rem; }
  .about-photo { min-height: 0; }
  .about-photo img { flex: none; height: auto; aspect-ratio: 1; }
  .quals { justify-content: flex-start; }
  .hero-photo { order: -1; margin-bottom: 1.2rem; }
  .ring { width: min(290px, 68vw); }
  .ring::before { inset: -8px; }
  .slide-dots { order: 2; margin-top: .5rem; }
  .hero-photo { display: flex; flex-direction: column; align-items: center; }
  .hero-copy { display: flex; flex-direction: column; align-items: center; text-align: center; }
  .pill { font-size: 1.02rem; padding: .35rem 1.3rem; margin-bottom: .8rem; }
  .hero h1 { font-size: clamp(1.3rem, 6vw, 2rem); margin-bottom: .7rem; }
  html[lang="en"] .hero h1 { font-size: clamp(.95rem, 4.7vw, 1.6rem); }
  .tagline, .degrees, .role { font-size: 1.12rem; }
  .place { font-size: 1.1rem; margin: .5rem 0 1.4rem; padding-bottom: 1rem; width: 100%; max-width: none; }
  .hero-actions { width: 100%; flex-direction: column; gap: .7rem; margin-bottom: 1.3rem; }
  .hero-actions .btn { width: 100%; }
  .hero-visit { width: 100%; max-width: none; text-align: start; padding: .9rem 1.1rem; }
  .hero-visit p { font-size: 1.02rem; }
  .hero-bg { height: 120px; opacity: .6; }

  .section { padding-block: 3.6rem; }
  .gallery { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 200px; }
  .g-w3 { grid-column: auto; }
  .g-w2 { grid-column: span 2; }
  .cond-groups { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .foot-cta-in { flex-direction: column; align-items: stretch; text-align: center; }
  .foot-cta-actions .btn { flex: 1 1 100%; }
  .foot-bottom-in { flex-direction: column; text-align: center; }
  .foot-note { flex: none; }
  .lightbox .lb-nav { top: auto; bottom: 1rem; translate: none; }
}

/* ---------------- Phone: app shell (bottom tab bar) ---------------- */
@media (max-width: 760px) {
  body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .nav-bar, .nav-toggle, .call-block { display: none !important; }
  /* the white header is only at the top of the page; it scrolls away (the bottom tab bar is the pinned nav) */
  .site-header { position: static; box-shadow: none; border-bottom: 1px solid var(--line); }
  html { scroll-padding-top: 1rem; }
  .header-in { align-items: flex-start; gap: .6rem; }
  .brand { align-items: flex-start; gap: .6rem; }
  .brand-mark { margin-top: 2px; }
  .brand-mark img { width: 46px; height: 46px; }
  .bb-name { font-size: 1rem; }

  .m-actions { display: flex; align-items: center; gap: 8px; flex: none; }
  .m-lang { min-height: 38px; padding: 0 14px; display: inline-flex; align-items: center; border: 1.5px solid var(--accent); border-radius: 999px; font-weight: 700; font-size: .85rem; text-decoration: none; color: var(--accent-deep); }
  .m-call { width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--brand); color: #fff; box-shadow: 0 6px 14px rgba(40, 34, 98, .30); }
  .m-call svg { width: 20px; height: 20px; }
  .m-call:hover { color: #fff; }

  .fact { padding: 1rem .9rem; }
  .fact-v { font-size: .98rem; }
  .sec-sub { font-size: 1.02rem; }

  /* compact hero: photo, name, serial buttons and today's chamber should all fit the first screen */
  .hero { padding: 1rem 0 1.6rem; }
  .hero-grid { gap: .9rem; }
  .hero-photo { margin-bottom: 0; }
  .ring { width: min(190px, 50vw); }
  .ring::before { inset: -6px; }
  .slides::after { box-shadow: inset 0 0 0 4px #fff; }
  .slide-dots { margin-top: .9rem; }
  .slide-dot { width: 22px; height: 22px; }
  .slide-dot::before { width: 8px; height: 8px; }
  .pill { font-size: .86rem; padding: .22rem .95rem; margin-bottom: .5rem; }
  .hero h1 { font-size: clamp(1.1rem, 5.2vw, 1.45rem); margin-bottom: .35rem; }
  html[lang="en"] .hero h1 { font-size: clamp(.95rem, 4.4vw, 1.3rem); }
  .tagline, .degrees, .role { font-size: .95rem; line-height: 1.45; margin: 0 0 .15rem; }
  .place { font-size: .95rem; line-height: 1.45; margin: .15rem 0 .8rem; padding-bottom: .6rem; border-bottom-width: 2px; }
  .hero-actions { flex-direction: row; flex-wrap: nowrap; gap: .5rem; margin-bottom: .8rem; }
  .hero-actions .btn { width: auto; flex: 1 1 0; min-height: 46px; padding-inline: .5rem; font-size: .92rem; white-space: nowrap; }
  .hero-actions .btn svg { width: 17px; height: 17px; }
  .hero-visit { padding: .6rem .85rem; border-inline-start-width: 4px; }
  .hero-visit p { font-size: .92rem; line-height: 1.5; }
  .hero-visit .today-note { font-size: .9rem; }
  .hero-bg { height: 70px; }

  /* gallery: photo on top, caption underneath on white (the photo is never covered) */
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: auto; grid-auto-flow: row; gap: 14px 12px; }
  .g-w3 { grid-column: auto; }
  .g-w2 { grid-column: span 2; }
  .g-item { display: flex; flex-direction: column; height: auto; background: #fff; border: 1px solid var(--line); text-align: start; }
  .g-item img { height: auto; aspect-ratio: 4 / 3; flex: none; }
  .g-item span { position: static; padding: .55rem .65rem .7rem; color: var(--ink); background: none; font-weight: 500; font-size: .86rem; line-height: 1.45; }

  /* horizontal snap rails, edge to edge */
  .rail {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 14px; scrollbar-width: none;
    margin-inline: calc(var(--gutter) * -1); padding: .9rem var(--gutter) .6rem; scroll-padding-inline: var(--gutter);
  }
  .rail::-webkit-scrollbar { display: none; }
  .rail > .vcard { flex: 0 0 62%; scroll-snap-align: start; }
  /* chamber cards: one under the other */
  .chambers { display: grid; grid-template-columns: 1fr; gap: 14px; }
  /* the videos page shows every card: wrap to a 2-col grid instead of one long rail */
  .rail--3 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; margin-inline: 0; padding-inline: 0; gap: 14px 12px; }
  .rail--3 > .vcard { flex: none; }
  .contact-page .chambers, .chambers-page .chambers { display: grid; grid-template-columns: 1fr; overflow: visible; margin-inline: 0; padding-inline: 0; }

  /* serial page: numbers reach the first screen */
  .chambers-page .page-head { padding-block: .9rem .6rem; }
  .chambers-page .page-head .crumbs, .chambers-page .page-head .lead { display: none; }
  .chambers-page .page-head h1 { font-size: 1.35rem; margin: 0; }
  .chambers-page .section-tint { padding-top: 1rem; }
  .serial-btns .sb-num { font-size: 1.2rem; }

  .yt-nav { display: none; }
  .cases-consent { padding: 1.1rem; }
  .cases-consent .gate-actions .btn { flex: 1 1 100%; }

  .posts { grid-template-columns: 1fr; }
  .cases--n1 { grid-template-columns: 1fr; }
  .cases--n2 .case-photos { gap: 10px; }
  .case--n3 .case-photos { grid-template-columns: 1fr; }
  .case-cover { font-size: .85rem; padding: 10px; }
  .page-head { padding-block: 1.6rem; }
  .doc { padding-block: 1.6rem; gap: 1.8rem; }
  .week-note { text-align: center; }
  .contact-list li { grid-template-columns: 6rem 1fr; }
  .foot-grid { padding-top: 2.4rem; }
  .foot-bottom-in { padding-bottom: 1.4rem; }
  .btn { min-height: 50px; }
  .btn-sm { min-height: 44px; }

  /* bottom tab bar */
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 90; left: 0; right: 0; bottom: 0;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(40, 34, 98, .10);
  }
  .tabbar a, .tabbar button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    margin: 6px 4px; border: 0; background: none; border-radius: var(--r-sm); color: var(--muted); text-decoration: none;
    font-size: .72rem; font-weight: 600; line-height: 1.1; -webkit-tap-highlight-color: transparent;
  }
  .tabbar svg { width: 23px; height: 23px; }
  .tabbar a[aria-current="page"] { background: var(--brand-soft); color: var(--accent-deep); }
  /* centre tab: the one patients come for */
  .tabbar .tab-serial { background: var(--accent-deep); color: #fff; font-weight: 700; box-shadow: 0 4px 12px rgba(0, 120, 146, .35); }
  .tabbar .tab-serial[aria-current="page"] { background: var(--brand); color: #fff; }
  .tabbar button[aria-expanded="true"] { background: var(--brand-soft); color: var(--brand); }

  /* more sheet */
  .sheet { display: block; position: fixed; inset: 0; z-index: 120; }
  .sheet[hidden] { display: none; }
  .sheet-backdrop { position: absolute; inset: 0; background: rgba(15, 12, 50, .55); }
  .sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 20px 20px 0 0; padding: 22px var(--gutter) calc(20px + env(safe-area-inset-bottom)); max-height: 82vh; overflow: auto; }
  .sheet-close { position: absolute; top: 8px; inset-inline-end: 10px; width: 44px; height: 44px; border: 0; background: none; color: var(--brand); }
  .sheet-close svg { width: 22px; height: 22px; }
  .sheet-panel ul { list-style: none; margin-top: 18px; border-top: 1px solid var(--line); }
  .sheet-panel li { border-bottom: 1px solid var(--line); }
  .sheet-panel li a { display: block; padding: 15px 2px; text-decoration: none; font-weight: 600; color: var(--ink); }
  .sheet-lang { margin: 16px 0 0; }
  .sheet-lang a { font-weight: 600; }
}

@media (max-width: 520px) {
  .foot-grid { grid-template-columns: 1fr; }
  .svc-grid { grid-template-columns: 1fr; }
  .week-row { grid-template-columns: repeat(4, 1fr); }
  .week { padding: 1rem; }
  .phones-big a { font-size: 1.45rem; }
  .form { padding: 1.3rem; }
}

@media (min-width: 761px) { .sheet[hidden] { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .wave path { stroke-dashoffset: 0; }
}
