/* Customer-facing mobile refinements. Load last; keep case and vial geometry intact. */
@media (max-width:760px) {
  /* Separate the tap targets from the decorative artwork, even at 320 px. */
  html:not(.admin-route) .collection-hero {
    padding:26px 20px 48px;
    gap:24px;
  }
  html:not(.admin-route) .collection-hero .catalog-heading-copy {
    position:relative;
    z-index:2;
  }
  html:not(.admin-route) .collection-hero .catalog-heading-actions {
    display:grid;
    grid-template-columns:minmax(0,1fr);
    gap:10px;
    width:100%;
  }
  html:not(.admin-route) .collection-hero .catalog-heading-actions a {
    width:100%;
    min-width:0;
    min-height:48px;
    margin:0;
    padding:13px 16px;
    border-radius:6px;
    font-size:14px;
    line-height:1.4;
    white-space:normal;
    box-sizing:border-box;
    touch-action:manipulation;
  }
  html:not(.admin-route) .collection-hero .catalog-view-cases {
    border:1px solid #8a816c;
    background:#ffffff08;
    color:#fff7e6;
  }
  html:not(.admin-route) .collection-hero .catalog-heading-actions a:focus-visible {
    outline:3px solid #fff2c6;
    outline-offset:3px;
  }
  html:not(.admin-route) .collection-hero .collection-stage {
    z-index:1;
    min-height:250px;
    pointer-events:none;
  }
  html:not(.admin-route) .collection-hero .collection-stage-vials {
    height:226px;
    align-items:center;
    padding:0;
  }
  html:not(.admin-route) .collection-hero .collection-stage-caption {
    margin-top:6px;
    line-height:1.5;
  }
  html:not(.admin-route) .collection-hero-note {
    left:20px;
    right:20px;
    bottom:16px;
  }
  html:not(.admin-route) :is(#main,#search-panel,.pbrx-chat) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]),select,textarea) {
    min-width:0;
    max-width:100%;
    min-height:44px;
    font-size:16px;
  }
  html:not(.admin-route) :is(.btn,.text-link,.pr-info-button,.pr-info-secondary,.pr-info-text-button,.pr-info-back,.account-edit-button,.account-identity>button,.account-empty-orders a,.commerce-tabs>a,.commerce-tabs>button,.syringes-add,.syringes-reset,.cases-actions a) {
    min-height:44px;
  }
  html:not(.admin-route) :is(.text-link,.pr-info-secondary,.pr-info-back,.account-empty-orders a) {
    display:inline-flex;
    align-items:center;
    max-width:100%;
  }
  html:not(.admin-route) .site-header {
    height:auto;
    min-height:82px;
    padding:10px 16px;
    gap:8px;
  }
  html:not(.admin-route) .site-header :is(.icon-button,.menu-toggle) {
    flex:0 0 44px;
    width:44px;
    height:44px;
    min-height:44px;
  }
  html:not(.admin-route) .site-header .bag-button {
    min-height:44px;
  }
  html:not(.admin-route) .site-header .header-actions {
    gap:5px;
    min-width:0;
  }
  html:not(.admin-route) .mobile-nav {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:6px;
    max-height:calc(100dvh - 100px);
    overflow-y:auto;
  }
  html:not(.admin-route) .mobile-nav a {
    display:flex;
    align-items:center;
    min-height:44px;
    font-size:14px;
    overflow-wrap:anywhere;
  }
  html:not(.admin-route) .search-panel>div {
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:8px;
  }
  html:not(.admin-route) .search-panel button {
    min-height:44px;
    font-size:14px;
  }

  /* Keep collection names readable; the strip scrolls without widening the page. */
  html:not(.admin-route) .catalog-tabs[role="tablist"] {
    display:flex;
    gap:8px;
    max-width:100%;
    overflow-x:auto;
    overscroll-behavior-inline:contain;
    scrollbar-width:thin;
  }
  html:not(.admin-route) .catalog-tabs [role="tab"] {
    flex:0 0 auto;
    grid-column:auto;
    min-height:48px;
    padding:12px 15px;
    font-size:14px;
    white-space:nowrap;
  }
  html:not(.admin-route) .catalog-controls {
    display:grid;
    grid-template-columns:minmax(0,1fr);
    gap:9px;
  }
  html:not(.admin-route) .is-syringes .catalog-controls {
    display:none;
  }
  html:not(.admin-route) .catalog-controls select {
    width:100%;
    max-width:none;
    min-width:0;
  }
  html:not(.admin-route) .catalog-search-label {
    max-width:none;
    min-width:0;
  }
  html:not(.admin-route) :is(.product-card,.product-body,.card-price) {
    min-width:0;
  }
  html:not(.admin-route) .product-body h2 {
    overflow-wrap:anywhere;
  }
  html:not(.admin-route) .card-strength {
    width:100%;
    min-height:44px;
    padding-block:9px;
    font-size:16px;
  }
  html:not(.admin-route) .card-quantity {
    grid-template-columns:44px minmax(20px,1fr) 44px;
    gap:3px;
  }
  html:not(.admin-route) .card-quantity button {
    width:44px;
    height:44px;
    min-height:44px;
    padding:0;
  }
  html:not(.admin-route) .card-quantity output {
    font-size:12px;
    white-space:normal;
    overflow-wrap:anywhere;
    text-align:center;
  }
  /* The familiar small i circle sits inside a larger, unobtrusive touch target. */
  html:not(.admin-route) .vial-note-cue {
    right:0;
    bottom:0;
    width:44px;
    height:44px;
    min-height:44px;
    border:0;
    background:transparent;
    box-shadow:none;
    isolation:isolate;
  }
  html:not(.admin-route) .vial-note-cue:before {
    content:'';
    position:absolute;
    inset:8px;
    z-index:-1;
    border:1px solid #c1b397;
    border-radius:50%;
    background:#fffdf5;
    box-shadow:0 2px 5px #171c2212;
    pointer-events:none;
  }
  html:not(.admin-route) .vial-note-cue:is(:hover,:focus-visible,[aria-expanded="true"]):before {
    border-color:#b08542;
    background:#f3d38e;
  }
  html:not(.admin-route) :is(.vial-notes-heading button,[data-vial-note-close],[data-case-vial-options],.case-select,.case-clear,.case-vial-menu button) {
    min-height:44px;
  }
  html:not(.admin-route) .vial-notes-heading button {
    flex:0 0 44px;
    width:44px;
  }
  html:not(.admin-route) .vial-notes-popover {
    width:min(320px,calc(100% - 24px));
    max-width:calc(100% - 24px);
  }
  html:not(.admin-route) .vial-notes-sources a {
    min-height:44px;
    align-items:center;
    font-size:13px;
  }
  html:not(.admin-route) .weekly-sale-clock small {
    font-size:9px;
    letter-spacing:.025em;
  }
  html:not(.admin-route) .weekly-sale-clock-label {
    font-size:10px;
  }
  html:not(.admin-route) .weekly-fire-sale .weekly-sale-deadline p {
    font-size:12px;
    line-height:1.5;
  }
  html:not(.admin-route) .weekly-sale-footer {
    font-size:11px;
    line-height:1.5;
  }

  html:not(.admin-route) .syringes-stepper {
    grid-template-columns:44px 48px 44px;
  }
  html:not(.admin-route) :is(.syringes-stepper button,.syringes-stepper input,.syringes-selection-controls button,.syringes-count-presets button) {
    min-height:44px;
    height:44px;
    min-width:44px;
    font-size:16px;
  }
  html:not(.admin-route) .syringes-selection-controls {
    grid-template-columns:44px 28px 44px;
  }
  html:not(.admin-route) .syringes-selection li {
    flex-wrap:wrap;
  }
  html:not(.admin-route) :is(.syringes-intro p,.syringes-placement-note,.syringes-selection-copy small) {
    font-size:13px;
    line-height:1.6;
  }

  /* Resource headings fit the content box rather than being clipped by the hero. */
  html:not(.admin-route) .pr-info-hero h1 {
    max-width:100%;
    font-size:clamp(2rem,9vw,3rem);
    line-height:1.03;
    letter-spacing:-.02em;
    overflow-wrap:anywhere;
  }
  html:not(.admin-route) .pr-info-section-head {
    flex-wrap:wrap;
    align-items:flex-start;
    gap:12px;
  }
  html:not(.admin-route) .pr-info-section-head>span {
    max-width:100%;
    font-size:12px;
    text-align:left;
  }
  html:not(.admin-route) .pr-info-section-head h2 {
    overflow-wrap:anywhere;
  }
  html:not(.admin-route) :is(.pr-info-hero-copy>p,.pr-info-help p,.pr-info-library-note,.pr-trial-card>p,.pr-faq-item>p) {
    font-size:14px;
    line-height:1.65;
  }
  html:not(.admin-route) :is(.pr-info-button,.pr-info-secondary,.pr-info-text-button,.pr-info-back,.pr-faq-topics>a) {
    font-size:14px;
  }
  html:not(.admin-route) .pr-compound-links {
    flex-wrap:wrap;
    gap:8px;
  }
  html:not(.admin-route) :is(.pr-compound-links,.pr-trial-links) a {
    display:inline-flex;
    align-items:center;
    min-height:44px;
    max-width:100%;
    font-size:14px;
    overflow-wrap:anywhere;
  }
  html:not(.admin-route) .pr-faq-topics>a {
    min-height:44px;
    align-items:center;
  }
  html:not(.admin-route) .pr-faq-item summary {
    min-height:56px;
    font-size:15px;
  }
  html:not(.admin-route) .contact-fields {
    grid-template-columns:minmax(0,1fr);
  }
  html:not(.admin-route) .policy-nav a {
    display:inline-flex;
    align-items:center;
    min-height:44px;
    font-size:14px;
  }
  html:not(.admin-route) .legal-page {
    padding:20px;
    min-width:0;
    overflow-wrap:anywhere;
  }
  html:not(.admin-route) .legal-page :is(p,li) {
    font-size:15px;
    line-height:1.7;
  }

  /* Quantity controls have their own full row on a narrow cart. */
  html:not(.admin-route) .cart-item {
    grid-template-columns:65px minmax(0,1fr);
    gap:14px;
  }
  html:not(.admin-route) .cart-item-art {
    grid-row:auto;
  }
  html:not(.admin-route) :is(.cart-item-copy,.drawer-item-copy) {
    min-width:0;
    overflow-wrap:anywhere;
  }
  html:not(.admin-route) .cart-item-controls {
    grid-column:1/-1;
    display:flex;
    flex-wrap:wrap;
    justify-content:space-between;
    align-items:center;
    gap:12px;
  }
  html:not(.admin-route) .cart-stepper {
    flex:0 0 auto;
  }
  html:not(.admin-route) .cart-stepper button {
    width:44px;
    min-width:44px;
    height:44px;
    min-height:44px;
    padding:0;
  }
  html:not(.admin-route) .cart-stepper output {
    display:grid;
    place-items:center;
    min-width:28px;
    height:44px;
    font-size:14px;
  }
  html:not(.admin-route) :is(.cart-remove,.drawer-remove,.drawer-continue,.cart-page-heading>a,.commerce-coupon-form button) {
    min-height:44px;
    font-size:14px;
  }
  html:not(.admin-route) .cart-page-heading>a {
    display:inline-flex;
    align-items:center;
  }
  html:not(.admin-route) .commerce-coupon-form>div {
    min-width:0;
  }
  html:not(.admin-route) .commerce-coupon-form input {
    min-width:0;
    height:44px;
    font-size:16px;
  }
  html:not(.admin-route) .cart-drawer {
    max-height:100dvh;
    padding:16px max(16px,env(safe-area-inset-right,0px)) calc(16px + env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px));
    overflow-y:auto;
    overscroll-behavior-y:contain;
  }
  html:not(.admin-route) .drawer-head {
    position:sticky;
    top:-16px;
    z-index:2;
    background:var(--panel,#fffefa);
  }
  html:not(.admin-route) .drawer-close {
    flex:0 0 44px;
    width:44px;
    height:44px;
    min-height:44px;
  }
  html:not(.admin-route) .drawer-item {
    grid-template-columns:52px minmax(0,1fr);
    gap:10px 12px;
  }
  html:not(.admin-route) .drawer-item-art {
    width:52px;
    grid-row:1/3;
  }
  html:not(.admin-route) .drawer-line-price {
    grid-column:2;
    justify-self:end;
    font-size:15px;
  }
  html:not(.admin-route) .drawer-item-actions {
    flex-wrap:wrap;
  }
  html:not(.admin-route) .case-cart-case>header>div {
    min-width:0;
  }
  html:not(.admin-route) .case-cart-lines li {
    flex-wrap:wrap;
  }
  html:not(.admin-route) :is(.case-cart-lines strong,.case-cart-supplies strong) {
    font-size:14px;
    overflow-wrap:anywhere;
  }
  html:not(.admin-route) .case-cart-lines span:not(.case-cart-row-qty) {
    font-size:12px;
  }

  html:not(.admin-route) :is(.account-signin-layout,.commerce-state-layout,.account-main-grid,.commerce-checkout-grid,.cart-layout,.account-profile-form) {
    grid-template-columns:minmax(0,1fr);
  }
  html:not(.admin-route) .account-identity {
    max-width:100%;
    min-width:0;
    overflow-wrap:anywhere;
  }
  html:not(.admin-route) .account-panel {
    padding:18px;
    min-width:0;
  }
  html:not(.admin-route) .account-panel-top {
    flex-wrap:wrap;
  }
  html:not(.admin-route) .account-order summary {
    grid-template-columns:minmax(0,1fr) auto;
    gap:8px 12px;
    min-height:56px;
  }
  html:not(.admin-route) .account-order summary>span:first-child {
    grid-column:1;
    grid-row:1/3;
    min-width:0;
  }
  html:not(.admin-route) .account-order-status {
    grid-column:2;
    grid-row:1;
    max-width:120px;
    font-size:12px;
    white-space:normal;
    overflow-wrap:anywhere;
    text-align:right;
  }
  html:not(.admin-route) .account-order summary>b {
    grid-column:2;
    grid-row:2;
    text-align:right;
  }
  html:not(.admin-route) .account-order>div p {
    font-size:14px;
    line-height:1.6;
    overflow-wrap:anywhere;
  }
  html:not(.admin-route) .commerce-summary>div {
    min-width:0;
  }
  html:not(.admin-route) .commerce-summary>div>span {
    min-width:0;
    overflow-wrap:anywhere;
  }
  html:not(.admin-route) .commerce-summary .commerce-grand {
    flex-wrap:wrap;
  }
  html:not(.admin-route) .commerce-options label {
    min-height:56px;
    font-size:14px;
  }
  html:not(.admin-route) .commerce-options label input {
    flex:0 0 18px;
  }
  html:not(.admin-route) .commerce-payment-note {
    overflow-wrap:anywhere;
  }
  html:not(.admin-route) :is(.rewards-header,.rewards-how,.rewards-history summary) {
    flex-wrap:wrap;
    gap:12px;
  }

  html:not(.admin-route) .footer-directory nav {
    min-width:0;
  }
  html:not(.admin-route) .footer-directory nav a {
    display:flex;
    align-items:center;
    min-height:44px;
    font-size:14px;
    overflow-wrap:anywhere;
  }
  html:not(.admin-route) .footer-bottom nav {
    flex-wrap:wrap;
    gap:8px 20px;
  }
  html:not(.admin-route) .footer-bottom nav a {
    display:inline-flex;
    align-items:center;
    min-height:44px;
    font-size:13px;
  }
  html:not(.admin-route) .toast {
    width:max-content;
    max-width:calc(100% - 24px);
    bottom:calc(20px + env(safe-area-inset-bottom,0px));
    white-space:normal;
    overflow-wrap:anywhere;
    font-size:14px;
  }
  html:not(.admin-route) .mobile-cases-enabled .toast {
    bottom:calc(var(--mobile-cases-bar-space) + 12px);
  }
  html:not(.admin-route) .toast button {
    min-height:44px;
  }
  /* A fixed panel uses the actual viewport width, including its scrollbar. */
  html:not(.admin-route) .pbrx-support .pbrx-chat {
    position:fixed;
    top:max(12px,env(safe-area-inset-top,0px));
    right:max(12px,env(safe-area-inset-right,0px));
    bottom:max(12px,env(safe-area-inset-bottom,0px));
    left:max(12px,env(safe-area-inset-left,0px));
    width:auto;
    height:auto;
    min-height:0;
    max-width:calc(100% - 24px);
    max-height:calc(100dvh - 24px);
    overflow-y:auto;
    overscroll-behavior-y:contain;
  }
  html:not(.admin-route) .pbrx-chat__header {
    position:sticky;
    top:0;
    z-index:2;
    gap:10px;
  }
  html:not(.admin-route) :is(.pbrx-chat__close,.pbrx-chat__refresh) {
    width:44px;
    height:44px;
    min-height:44px;
    flex:0 0 44px;
  }
  html:not(.admin-route) :is(.pbrx-chat__send,.pbrx-chat__latest,.pbrx-chat__suggestions button,.pbrx-chat__footer a) {
    min-height:44px;
    font-size:13px;
  }
  html:not(.admin-route) .pbrx-chat__footer a {
    display:inline-flex;
    align-items:center;
  }
  html:not(.admin-route) .pbrx-chat__history {
    flex:1 1 0;
    min-height:0;
    max-height:none;
    overflow-y:auto;
  }
  html:not(.admin-route) :is(.pbrx-chat__bubble p,.pbrx-chat__welcome p) {
    font-size:14px;
  }
  html:not(.admin-route) .pbrx-chat__form-bottom {
    flex-wrap:wrap;
  }
  html:not(.admin-route) .pbrx-chat__footer>div {
    flex-wrap:wrap;
  }
}

@media (max-width:360px) {
  html:not(.admin-route) .site-header {
    padding-inline:12px;
    gap:4px;
  }
  html:not(.admin-route) .site-header>.store-brand .store-brand-logo {
    width:98px;
  }
  html:not(.admin-route) .site-header .header-brand {
    width:98px;
    min-width:98px;
  }
  html:not(.admin-route) .site-header .header-actions {
    gap:4px;
  }
  html:not(.admin-route) .site-header .bag-button {
    padding-inline:7px;
    gap:5px;
    font-size:12px;
  }
  html:not(.admin-route) #catalog-results .product-grid {
    gap:12px 10px;
  }
  html:not(.admin-route) #catalog-results .product-body {
    padding-inline:8px;
  }
  html:not(.admin-route) .fire-sale-grid {
    grid-template-columns:minmax(0,1fr);
  }
  html:not(.admin-route) .fire-sale-grid .product-card,
  html:not(.admin-route) .fire-sale-grid .product-card:last-child {
    grid-column:auto;
    display:grid;
    grid-template-columns:minmax(76px,30%) minmax(0,1fr);
    align-items:center;
    gap:12px;
    padding:10px;
  }
  html:not(.admin-route) .fire-sale-grid .product-art {
    height:150px;
    margin:0;
  }
  html:not(.admin-route) .weekly-sale-deadline {
    grid-template-columns:minmax(0,1fr);
  }
  html:not(.admin-route) .weekly-sale-clock-label {
    max-width:none;
  }
  html:not(.admin-route) .weekly-sale-clock {
    justify-content:space-between;
  }
  html:not(.admin-route) .weekly-sale-clock>span {
    width:calc((100% - 12px)/4);
  }
  html:not(.admin-route) .syringes-selection-controls {
    margin-left:auto;
  }
  html:not(.admin-route) .footer-directory {
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  html:not(.admin-route) .footer-directory .footer-brand {
    grid-column:1/-1;
  }
  html:not(.admin-route) .pbrx-chat__header {
    padding:14px 12px;
  }
  html:not(.admin-route) .pbrx-chat__identity {
    gap:8px;
  }
  html:not(.admin-route) .pbrx-chat__mark {
    width:34px;
    height:38px;
  }
  html:not(.admin-route) .pbrx-chat__header h2 {
    font-size:20px;
  }
}

@media (max-width:760px) and (max-height:650px) {
  /* The history takes only the space left by the composer and footer. */
  html:not(.admin-route) .pbrx-chat__form textarea {
    max-height:min(100px,18dvh);
  }
}
