/* Shared final layout layer. Keep themes, hero timing and business logic intact.
   Fluid widths cover folded/unfolded devices without device-name detection. */
:root { --screen-gutter: clamp(12px, 3vw, 40px); }
html { -webkit-text-size-adjust: 100%; }
*, *::before, *::after { box-sizing: border-box; }
:where(main, section, article, aside, header, footer, nav, form, fieldset, div) { min-inline-size: 0; }
:where(h1, h2, h3, h4, p, label, a, button, strong, code) { overflow-wrap: anywhere; }
:where(input, select, textarea) { min-inline-size: 0; max-inline-size: 100%; }
:where(img, video, iframe) { max-inline-size: 100%; }
:where(button, .btn) { white-space: normal; }
.contact-request-heading { width: 100%; }
.referral-box code, .loyalty-referral-panel label { min-width: 0; }
.loyalty-rewards-list { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.loyalty-check input[type="checkbox"] { width: 20px; flex: 0 0 20px; }
.qr-modal-card { max-height: calc(100dvh - 32px); overflow-y: auto; }
.cart-drawer { max-height: 100dvh; padding-bottom: env(safe-area-inset-bottom, 0px); }
.cart-items { min-height: 0; }
.footer-bottom, .loyalty-public-footer { flex-wrap: wrap; }

/* Content stays readable on ultrawide monitors; full-bleed media stays full width. */
@media (min-width: 1920px) {
  .panel-grid, .training-grid, .contact-request-layout, .contact-store-layout,
  .loyalty-public-main, .article-route { max-width: 1440px; margin-inline: auto; }
}

@media (max-width: 1200px) {
  #site-header .main-nav { display: none; }
  #site-header .burger { display: flex; }
  #mobile-nav { max-height: 100dvh; overflow-y: auto; overscroll-behavior: contain; }
}

@media (max-width: 900px) {
  .contact-request-heading { grid-template-columns: minmax(0, 1fr); }
  .contact-request-heading > * { grid-column: 1; min-width: 0; max-width: 100%; }
  .contact-request-heading h2 { font-size: clamp(1.8rem, 6vw, 3rem); }
}

@media (max-width: 1050px) {
  .knowledge-page:not(.article-page) .expert-dog { left: 50%; transform: translateX(-50%); }
}

@media (max-width: 600px) {
  :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) { font-size: 16px; }
  :where(.btn, .primary-button, .secondary-button, .contact-book-btn, .service-tab) { min-height: 44px; }
  .panel-grid, .date-row, .contact-fields, .pet-fields, .loyalty-form-grid { grid-template-columns: minmax(0, 1fr); }
  .panel-form, .loyalty-card-wrap, .loyalty-enroll, .loyalty-history,
  .loyalty-referral-panel, .loyalty-rewards-panel { padding: 20px 14px; }
  .digital-card { padding: 22px 16px; }
  .section-heading, .voucher-row { flex-wrap: wrap; }
  .loyalty-public-header nav { flex-wrap: wrap; border-radius: 16px; }
  .loyalty-public-header nav a { min-height: 44px; }
  .qr-modal { padding: 12px; }
  .qr-modal-card { padding: 42px 14px 18px; }
  .qr-modal-card #large-qr { max-width: 100%; }
  .product-detail-card { max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow-y: auto; }
  .cart-drawer { width: 100%; max-width: 100%; }
  .cart-footer { max-height: 55dvh; overflow-y: auto; }
  .swal2-popup { width: min(100%, 32em); max-height: calc(100dvh - 24px); overflow-y: auto; }
  .knowledge-page:not(.article-page) .expert-section { width: calc(100% - 24px); min-width: 0; margin-inline: auto; padding: 205px 16px 20px; grid-template-columns: minmax(0, 1fr); }
  .knowledge-page:not(.article-page) .expert-dog { left: 50%; transform: translateX(-50%); }
  .knowledge-page:not(.article-page) .social-links { flex-wrap: wrap; }
  .knowledge-page:not(.article-page) .knowledge-footer .footer-creator { position: static; justify-self: center; white-space: normal; flex-wrap: wrap; line-height: 1.5; }
  .knowledge-page:not(.article-page) .knowledge-nav { max-height: calc(100dvh - 100px); overflow-y: auto; }
  .ht-dog3d-model { width: min(560px, 100vw); height: auto; aspect-ratio: 7 / 6; }
  .ht-dog3d-scene { overflow: hidden; }
}

/* Narrow cover displays: keep cart, languages, theme and menu reachable. */
@media (max-width: 380px) {
  #site-header .header-inner { display: flex; gap: 4px; padding-inline: 6px !important; }
  #site-header .logo { flex: 0 0 36px; gap: 0; }
  #site-header .logo img { width: 36px; height: 36px; }
  #site-header .logo > span { display: none; }
  #site-header .header-actions { flex: 1; justify-content: flex-end; gap: 4px; }
  #site-header .header-actions > .btn-sm { display: none; }
  #site-header .cart-trigger { display: flex; width: 32px; height: 44px; flex: 0 0 32px; }
  #site-header .cart-count { right: -1px; top: 0; }
  #site-header .theme-toggle { width: 40px; flex: 0 0 40px; }
  #site-header .lang-switch { display: flex; padding: 2px; gap: 0; }
  #site-header .lang-btn { width: 27px; padding: 0; min-height: 40px; }
  #site-header .lang-code, #site-header .lang-sep { display: none; }
  #site-header .burger[data-smart-burger], #site-header .burger { width: 38px; flex: 0 0 38px; height: 44px; }
  .home-page .hero-content { padding-inline: 12px; }
  .hero-title, .services-hero-title { font-size: clamp(1.7rem, 9vw, 2.15rem); }
  .service-tabs { padding: 8px; gap: 6px; }
  .service-tab { width: 100%; }
  .tip-card.article-card { grid-template-columns: minmax(0, 1fr); }
  .tip-card > img { height: 160px; }
  .knowledge-brand strong { font-size: .95rem; }
  .knowledge-header { gap: 8px; }
  .article-back { font-size: .75rem; }
  .footer-top { padding-inline: 16px; }
  .newsletter-form { min-width: 0; }
  .newsletter-form input { width: 100%; min-width: 0; }
}

/* Short landscape windows / keyboards must not trap navigation or dialogs. */
@media (max-height: 500px) {
  #mobile-nav nav { margin-block: auto; padding-block: 80px 24px; }
  .qr-modal, .cart-choice-dialog { align-items: start; overflow-y: auto; }
  .cart-footer { max-height: 48dvh; }
  .hero { min-height: 100svh; height: auto; }
}
@supports (padding: max(0px)) {
  #site-header { margin-left: env(safe-area-inset-left, 0px); margin-right: env(safe-area-inset-right, 0px); }
  .site-footer, .knowledge-footer { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
}
