/* v163–v165: text-based phone identity and a purpose-built tablet masthead.
   Sticky headers stay in normal flow; only wide desktops use the scroll swap. */
@media screen and (max-width: 640px), screen and (max-width: 1120px) and (max-height: 540px) {
  body > .hideinmobile { display: none !important; }
  body > .hamburger {
    display: block !important;
    /* Reset the legacy container's side/bottom padding as well. */
    padding: env(safe-area-inset-top, 0px) 0 0;
    border-bottom: 1px solid rgba(213, 191, 214, .3);
  }
  body > .hamburger > div { gap: 8px; padding: 6px 12px; }
  body > .hamburger .logo { min-width: 0; }
  body > .hamburger .mobile-brand {
    display: block;
    position: relative;
    min-width: 0;
    margin: 0;
    padding: 0 0 0 47px;
    color: #eadfeb;
    text-align: left;
    text-decoration: none;
  }
  body > .hamburger .mobile-brand::before,
  body > .hamburger .mobile-brand::after { display: none; }
  body > .hamburger .mobile-brand img {
    /* Match the complete text block, without letting the image set row height. */
    position: absolute;
    top: 0;
    left: 0;
    width: auto;
    max-width: none !important;
    height: 100%;
    object-fit: contain;
  }
  .mobile-brand-copy { display: block; min-width: 0; }
  .mobile-brand-name {
    display: block;
    font: 750 clamp(18px, 4.8vw, 25px)/1.25 var(--font-cjk, sans-serif);
    letter-spacing: .035em;
    white-space: nowrap;
  }
  .mobile-brand-fullname {
    display: block;
    max-width: 29ch;
    margin-top: 2px;
    color: #d5bfd6;
    font: 500 clamp(10.5px, 2.8vw, 12px)/1.35 var(--font-latin, sans-serif);
    text-wrap: balance;
  }
  body > .hamburger .containerburger {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    width: 54px;
    min-width: 54px;
    min-height: 48px;
    padding: 4px 5px;
    border-radius: 9px;
    background: rgba(213, 191, 214, .07);
    box-shadow: none;
  }
  body > .hamburger .burger-icon { flex: 0 0 22px; }
  body > .hamburger .menu-label { min-width: 0; font-size: 11px; }
  body > .hamburger .dropdown-content {
    max-height: calc(100dvh - 68px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  }
}

/* Short, wide viewports (including landscape phones) need one compact row.
   Height, rather than a guessed device model, distinguishes these from iPads. */
@media screen and (min-width: 641px) and (max-width: 1120px) and (max-height: 540px) {
  .mobile-brand-name { font-size: 20px; line-height: 1.15; }
  .mobile-brand-fullname {
    max-width: none;
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
  }
  body > .hamburger .containerburger {
    flex-direction: row;
    width: auto;
    min-width: 78px;
    min-height: 44px;
    padding: 6px 8px;
    gap: 7px;
  }
  body > .hamburger .dropdown-content {
    max-height: calc(100dvh - 60px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* v164: a voluntary language suggestion should not cover the form/calendar. */
.language-suggestion {
  position: relative;
  z-index: auto;
  inset: auto;
  margin: 16px auto;
  transform: none;
  animation: none;
}
.contact-summary .reservation-returning {
  margin: 12px 0 0;
  padding: 0;
}
.reservation-returning .reservation-phone-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid rgba(213, 191, 214, .7);
  border-radius: 8px;
  color: #eadfeb;
  background: rgba(213, 191, 214, .07);
  font-weight: 650;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
}
.reservation-returning .reservation-phone-link:hover,
.reservation-returning .reservation-phone-link:focus-visible {
  color: #fff;
  background: rgba(213, 191, 214, .17);
  outline: 2px solid #eadfeb;
  outline-offset: 3px;
}

@media screen and (min-width: 641px) and (max-width: 1120px) and (min-height: 541px) {
  html { scroll-padding-top: calc(var(--desktop-masthead-height, 138px) + 20px); }
  body > .hamburger { display: none !important; }
  body > .hideinmobile {
    display: block !important;
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    padding-top: env(safe-area-inset-top, 0px);
    border-bottom: 1px solid rgba(213, 191, 214, .3);
    background: #341935;
    box-shadow: 0 5px 16px rgba(0, 0, 0, .22);
  }
  .masthead-flow-placeholder,
  .masthead-flow-placeholder.is-active { display: none; }
  body > .hideinmobile .grid-container {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    grid-template-areas: "logo chinese" "logo fullname" "navbar navbar";
    gap: 0 18px;
    width: calc(100% - 48px);
    max-width: 1000px;
    margin: 0 auto;
    padding: 10px 0 0;
    background: #341935;
    box-shadow: none !important;
  }
  body > .hideinmobile .grid-container > div { min-width: 0; transition: none; }
  body > .hideinmobile .grid-container > .item1 {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 0;
  }
  body > .hideinmobile .item1 img {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    display: block;
    width: auto !important;
    max-width: none !important;
    height: 100%;
    object-fit: contain;
    transition: none;
  }
  body > .hideinmobile .grid-container > .item2 { display: none; }
  body > .hideinmobile .grid-container > .item4 {
    display: block;
    align-self: end;
    min-height: 0;
    padding: 0;
  }
  body > .hideinmobile .brand-chinese {
    font-size: clamp(28px, 4vw, 40px);
    line-height: 1.2;
    letter-spacing: .1em;
    text-align: left;
    transition: none;
  }
  body > .hideinmobile .grid-container > .item5 {
    display: block;
    align-self: start;
    padding: 6px 0 0;
  }
  body > .hideinmobile .brand-fullname {
    padding: 0;
    font-size: 16px;
    line-height: 1.4;
    text-align: left;
  }
  body > .hideinmobile .grid-container > .item6 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1.4fr) minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 6px 0;
    border-top: 1px solid rgba(213, 191, 214, .25);
    white-space: normal;
  }
  body > .hideinmobile .item6 > a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin: 0;
    padding: 6px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.35;
    text-align: center;
    text-wrap: balance;
    transition: background-color .2s ease;
  }
  body > .hideinmobile .item6 > a::before,
  body > .hideinmobile .item6 > a::after { display: none; }
  body > .hideinmobile .item6 > a:hover,
  body > .hideinmobile .item6 > a[aria-current="page"] { background: rgba(213, 191, 214, .12); }
  .desktop-language-picker {
    position: relative;
    display: block;
    margin: 0;
    color: #eadfeb;
    font: 650 14px/1.35 var(--font-latin, sans-serif);
  }
  .desktop-language-picker summary {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid rgba(213, 191, 214, .75);
    border-radius: 999px;
    box-shadow: none;
    color: inherit;
    font: inherit;
    white-space: nowrap;
    list-style: none;
    cursor: pointer;
  }
  .desktop-language-picker summary::-webkit-details-marker { display: none; }
  .desktop-language-picker summary::after { content: " ▾"; white-space: pre; }
  .desktop-language-picker[open] summary::after { content: " ▴"; }
  .desktop-language-picker summary:hover,
  .desktop-language-picker[open] summary { background: rgba(213, 191, 214, .12); }
  .desktop-language-options {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1200;
    display: grid;
    width: 180px;
    gap: 4px;
    padding: 8px;
    border: 1px solid rgba(213, 191, 214, .75);
    border-radius: 12px;
    background: #341935;
    box-shadow: 0 10px 26px rgba(0, 0, 0, .3);
  }
  body > .hideinmobile .item6 .desktop-language-link {
    display: block;
    min-height: 44px;
    margin: 0;
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
    text-align: left;
    text-decoration: none;
  }
  .item6.container .desktop-language-options a::before,
  .item6.container .desktop-language-options a::after { display: none; }
  .item6.container .desktop-language-options a:hover,
  .item6.container .desktop-language-options a[aria-current="page"] { background: #eadfeb; color: #341935; }
  .contact-summary { top: calc(var(--desktop-masthead-height, 138px) + 20px); }
}

@media screen and (max-width: 1120px) {
  .mobile-brand:focus-visible,
  body > .hideinmobile .item6 a:focus-visible,
  .desktop-language-picker summary:focus-visible {
    outline: 2px solid #eadfeb;
    outline-offset: 3px;
  }
}
