/* mobile.css — layout for viewports < 1024px.
   Loaded via <link media="(max-width: 1023px)">. Desktop rules live in
   index.css inside @media (min-width: 1024px). Tokens match Figma 148:1197.

   Scale unit: --cc-u (baseline 390). Mọi font/gap/width/padding dùng
   calc(N * var(--cc-u)) — khi khối cha hẹp, --cc-u nhỏ theo → UI thu cùng tỷ lệ. */

@media (max-width: 1023px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    min-height: 100svh;
    min-height: 100dvh;
    overflow-x: hidden;
  }

  body {
    background-color: #3fa1f0;
    color: #364859;
  }

  img {
    max-width: 100%;
  }

  .page {
    --cc-u: calc(min(100vw, 500px) / 390);
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    min-height: 100svh;
    min-height: 100dvh;
    width: 100%;
    max-width: 500px;
    margin-inline: auto;
    overflow-x: hidden;
    container-type: inline-size;
  }

  @supports (width: 1cqi) {
    .page {
      --cc-u: calc(100cqi / 390);
    }
  }

  .page::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background-color: #3fa1f0;
    background-image: url("assets/mb-bg.webp");
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    pointer-events: none;
  }

  /* ----- Header ----- */
  .header {
    position: sticky;
    top: 0;
    z-index: 20;
    width: 100%;
    max-width: 100%;
    background: #26a9e0;
    padding-top: env(safe-area-inset-top, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    box-shadow: 0 calc(2 * var(--cc-u)) calc(10 * var(--cc-u)) rgba(2, 87, 130, 0.18);
  }

  .header__inner {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
    min-height: calc(56 * var(--cc-u));
    padding: calc(8 * var(--cc-u)) calc(16 * var(--cc-u));
  }

  .header__logo {
    display: block;
    width: auto;
    height: calc(42 * var(--cc-u));
    object-fit: contain;
    flex: 0 0 auto;
  }

  .header__menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: calc(40 * var(--cc-u));
    height: calc(40 * var(--cc-u));
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    flex: 0 0 auto;
  }

  .header__menu-icon {
    display: block;
    width: calc(40 * var(--cc-u));
    height: calc(40 * var(--cc-u));
    object-fit: contain;
    /* icon-menu.png: white glyph on black — blend so black drops on blue bar */
    mix-blend-mode: screen;
  }

  /* Desktop-style header nav hidden on mobile — dùng drawer trái */
  .nav {
    display: none;
  }

  .drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(14, 55, 78, 0.45);
    border: 0;
    padding: 0;
    cursor: pointer;
  }

  .drawer-backdrop[hidden] {
    display: none;
  }

  .drawer {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    width: 75%;
    max-width: calc(420 * var(--cc-u));
    height: 100%;
    height: 100dvh;
    background: #26a9e0;
    box-shadow: calc(8 * var(--cc-u)) 0 calc(28 * var(--cc-u)) rgba(2, 87, 130, 0.28);
    transform: translateX(-105%);
    transition: transform 0.28s ease;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding:
      env(safe-area-inset-top, 0px)
      0
      calc(calc(16 * var(--cc-u)) + env(safe-area-inset-bottom, 0px));
  }

  .drawer.drawer--open {
    transform: translateX(0);
  }

  .drawer__head {
    display: flex;
    align-items: center;
    min-height: calc(56 * var(--cc-u));
    padding: calc(8 * var(--cc-u)) calc(16 * var(--cc-u));
    background: #26a9e0;
    flex: 0 0 auto;
  }

  .drawer__logo {
    display: block;
    width: auto;
    height: calc(42 * var(--cc-u));
    object-fit: contain;
  }

  .drawer__nav {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin: 0;
    padding: calc(4 * var(--cc-u)) 0 calc(8 * var(--cc-u));
    background: #26a9e0;
    border-radius: 0 0 calc(16 * var(--cc-u)) calc(16 * var(--cc-u));
    flex: 0 0 auto;
  }

  .drawer__link {
    display: block;
    padding: calc(12 * var(--cc-u)) calc(18 * var(--cc-u));
    font-family: "Roboto", sans-serif;
    font-weight: 600;
    font-size: calc(12 * var(--cc-u));
    line-height: calc(16 * var(--cc-u));
    color: #ffffff;
    text-decoration: none;
    text-transform: uppercase;
    border-bottom: calc(1 * var(--cc-u)) solid rgba(255, 255, 255, 0.2);
  }

  .drawer__link:last-child {
    border-bottom: 0;
  }

  .drawer__link:active {
    background: rgba(255, 255, 255, 0.08);
  }

  body.nav-open {
    overflow: hidden;
  }

  /* ----- Main ----- */
  .main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    max-width: 100%;
    gap: calc(20 * var(--cc-u));
    padding:
      calc(16 * var(--cc-u))
      calc(16 * var(--cc-u))
      calc(calc(20 * var(--cc-u)) + env(safe-area-inset-bottom, 0px));
  }

  /* ----- Card ----- */
  .card {
    width: 100%;
    max-width: calc(520 * var(--cc-u));
    background: #ffffff;
    border: calc(1.875 * var(--cc-u)) solid #02a9dd;
    border-radius: calc(18.75 * var(--cc-u));
    box-shadow: 0 0 calc(32 * var(--cc-u)) #4c6d7e;
    overflow: hidden;
    backdrop-filter: blur(calc(29.531 * var(--cc-u)));
    -webkit-backdrop-filter: blur(calc(29.531 * var(--cc-u)));
  }

  .card__inner {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: calc(20 * var(--cc-u)) calc(16 * var(--cc-u)) calc(22 * var(--cc-u));
    gap: calc(16 * var(--cc-u));
  }

  .brand {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(12 * var(--cc-u));
    flex: 0 0 auto;
  }

  .brand__logo {
    display: block;
    width: calc(188 * var(--cc-u));
    height: auto;
    object-fit: contain;
  }

  .brand__badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    max-width: 100%;
    min-height: calc(32 * var(--cc-u));
    padding: calc(6 * var(--cc-u)) calc(18 * var(--cc-u));
    background: #e4f5ff;
    border-radius: calc(271.64 * var(--cc-u));
  }

  .brand__badge-text {
    margin: 0;
    font-family: "Roboto", sans-serif;
    font-weight: 600;
    font-size: calc(13 * var(--cc-u));
    line-height: calc(18 * var(--cc-u));
    color: #26a7df;
    text-align: center;
    font-style: normal;
    white-space: nowrap;
  }

  .card__art {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    object-fit: contain;
    flex: 0 0 auto;
  }

  .card__desc {
    width: 100%;
    font-family: "Roboto", sans-serif;
    font-weight: 400;
    font-size: calc(12 * var(--cc-u));
    line-height: calc(21 * var(--cc-u));
    color: #364859;
    text-align: center;
    flex: 0 0 auto;
  }

  .card__desc-brand {
    font-weight: 700;
    color: #26a7df;
  }

  .contact-title {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: calc(8 * var(--cc-u));
    flex: 0 0 auto;
  }

  .contact-title__line {
    flex: 1 1 0;
    width: auto;
    min-width: calc(8 * var(--cc-u));
    height: 0;
    border-top: calc(1 * var(--cc-u)) solid #364859;
    border-radius: calc(1 * var(--cc-u));
  }

  .contact-title__text {
    margin: 0;
    flex: 0 0 auto;
    font-family: "Roboto", sans-serif;
    font-weight: 700;
    font-size: calc(12 * var(--cc-u));
    line-height: calc(16 * var(--cc-u));
    color: #26a7df;
    text-align: center;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .contacts {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: calc(6 * var(--cc-u));
    flex: 0 0 auto;
  }

  .contact-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    max-width: none;
    height: calc(36 * var(--cc-u));
    padding: calc(2 * var(--cc-u)) calc(8 * var(--cc-u)) calc(2 * var(--cc-u)) calc(3 * var(--cc-u));
    background: #ffffff;
    border: calc(1 * var(--cc-u)) solid #02a9dd;
    border-radius: calc(88 * var(--cc-u));
    text-decoration: none;
    color: inherit;
    gap: calc(4 * var(--cc-u));
    -webkit-tap-highlight-color: transparent;
  }

  .contact-btn:active {
    background: #f3fbff;
  }

  .contact-btn__icon {
    display: block;
    width: calc(28 * var(--cc-u));
    height: calc(28 * var(--cc-u));
    object-fit: contain;
    flex: 0 0 calc(28 * var(--cc-u));
  }

  .contact-btn__label {
    font-family: "Roboto", sans-serif;
    font-weight: 600;
    font-size: calc(11 * var(--cc-u));
    line-height: calc(12 * var(--cc-u));
    color: #364859;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ----- Showcase ----- */
  .showcase {
    width: 100%;
    max-width: calc(520 * var(--cc-u));
    display: flex;
    justify-content: center;
    overflow: visible;
    padding: 0 calc(30 * var(--cc-u));
  }

  .showcase__img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
  }
}

/* Very narrow: allow wrap; scale đã lo phần còn lại qua --cc-u */
@media (max-width: 1023px) and (max-width: 359px) {
  .brand__badge-text,
  .contact-title__text {
    white-space: normal;
  }
}

/* Tablet: chỉ đổi layout (2 cột). Size scale theo --cc-u. */
@media (min-width: 768px) and (max-width: 1023px) {
  .main {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
  }

  .card {
    flex: 1 1 calc(340 * var(--cc-u));
    max-width: calc(460 * var(--cc-u));
  }

  .showcase {
    flex: 1 1 calc(300 * var(--cc-u));
    max-width: calc(440 * var(--cc-u));
  }
}
