/*
 * Copyright 2020 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */

:root {
  /* colors */
  --background-color: white;
  --light-color: #f8f8f8;
  --dark-color: #505050;
  --text-color: #131313;
  --link-color: #3b63fb;
  --link-hover-color: #1d3ecf;

  /* fonts */
  --body-font-family: licium-regular, licium-fallback, "Segoe UI", "Helvetica Neue", helvetica, arial, sans-serif;
  --heading-font-family: licium-medium, licium-medium-fallback, "Segoe UI", "Helvetica Neue", helvetica, arial, sans-serif;

  /* body sizes */
  --body-font-size-m: 22px;
  --body-font-size-s: 19px;
  --body-font-size-xs: 17px;

  /* heading sizes */
  --heading-font-size-xxl: 55px;
  --heading-font-size-xl: 44px;
  --heading-font-size-l: 34px;
  --heading-font-size-m: 27px;
  --heading-font-size-s: 24px;
  --heading-font-size-xs: 22px;

  /* Keep the eager nav reservation identical to header.css. A 64px shell
   * collapsing to the real 50px header moved the full-viewport Product Hero. */
  --nav-height: 50px;
}

/*
 * Arabic typography follows the supplied Licium 32px → Tajawal 36px reference.
 * Keeping these faces in the eager stylesheet prevents mobile Arabic pages from
 * waiting for the deferred fonts.css request. The Arabic-only ranges preserve
 * the existing Licium rendering for Latin text on mixed-language pages.
 */
@font-face {
  font-family: tajawal;
  font-style: normal;
  font-weight: 200;
  font-display: swap;
  size-adjust: 112.5%;
  src: url('../fonts/tajawal-extra-light.woff2') format('woff2');
  unicode-range:
    U+0020,
    U+00A0,
    U+0600-06FF,
    U+0750-077F,
    U+0870-089F,
    U+08A0-08FF,
    U+2000-206F,
    U+FB50-FDFF,
    U+FE70-FEFF,
    U+1EE00-1EEFF;
}

@font-face {
  font-family: tajawal;
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  size-adjust: 112.5%;
  src: url('../fonts/tajawal-light.woff2') format('woff2');
  unicode-range:
    U+0020,
    U+00A0,
    U+0600-06FF,
    U+0750-077F,
    U+0870-089F,
    U+08A0-08FF,
    U+2000-206F,
    U+FB50-FDFF,
    U+FE70-FEFF,
    U+1EE00-1EEFF;
}

@font-face {
  font-family: tajawal;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  size-adjust: 112.5%;
  src: url('../fonts/tajawal-regular.woff2') format('woff2');
  unicode-range:
    U+0020,
    U+00A0,
    U+0600-06FF,
    U+0750-077F,
    U+0870-089F,
    U+08A0-08FF,
    U+2000-206F,
    U+FB50-FDFF,
    U+FE70-FEFF,
    U+1EE00-1EEFF;
}

@font-face {
  font-family: tajawal;
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  size-adjust: 112.5%;
  src: url('../fonts/tajawal-medium.woff2') format('woff2');
  unicode-range:
    U+0020,
    U+00A0,
    U+0600-06FF,
    U+0750-077F,
    U+0870-089F,
    U+08A0-08FF,
    U+2000-206F,
    U+FB50-FDFF,
    U+FE70-FEFF,
    U+1EE00-1EEFF;
}

@font-face {
  font-family: tajawal;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  size-adjust: 112.5%;
  src: url('../fonts/tajawal-bold.woff2') format('woff2');
  unicode-range:
    U+0020,
    U+00A0,
    U+0600-06FF,
    U+0750-077F,
    U+0870-089F,
    U+08A0-08FF,
    U+2000-206F,
    U+FB50-FDFF,
    U+FE70-FEFF,
    U+1EE00-1EEFF;
}

/* Existing component stacks name Licium directly. These Arabic faces let the
 * browser keep those stacks and substitute only the glyphs Licium does not own. */
@font-face {
  font-family: licium-regular;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  size-adjust: 112.5%;
  src: url('../fonts/tajawal-regular.woff2') format('woff2');
  unicode-range:
    U+0600-06FF,
    U+0750-077F,
    U+0870-089F,
    U+08A0-08FF,
    U+FB50-FDFF,
    U+FE70-FEFF,
    U+1EE00-1EEFF;
}

@font-face {
  font-family: licium-medium;
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  size-adjust: 112.5%;
  src: url('../fonts/tajawal-medium.woff2') format('woff2');
  unicode-range:
    U+0600-06FF,
    U+0750-077F,
    U+0870-089F,
    U+08A0-08FF,
    U+FB50-FDFF,
    U+FE70-FEFF,
    U+1EE00-1EEFF;
}

/* Full-bleed blocks use 100vw, which ignores the scrollbar width; clip the
   resulting few pixels of horizontal overflow instead of showing a scrollbar. */
html,
body {
  overflow-x: clip;
}

/* Single source of truth for modal scroll locking; owned by scripts/scroll-lock.mjs.
   `<dialog>.showModal()` does not stop the background from scrolling, so every
   modal-like surface reference-counts this class instead of writing its own. */
html.scroll-locked {
  overflow: hidden;
  width: calc(100% - var(--page-scrollbar-width, 0px));
}

/* Page-shell override for the test-drive page. The body class is set by the
   block's own decorate(); the global footer remains part of the page flow. */
body.has-lixiang-test-drive-booking {
  background: #fff;
}

html {
  scrollbar-gutter: auto;
  scrollbar-width: auto;
}

html.is-homepage {
  scrollbar-gutter: auto;
  scrollbar-width: none;
}

html.is-homepage::-webkit-scrollbar {
  display: none;
}

html[dir="rtl"] {
  --body-font-family: tajawal, tajawal-fallback, licium-regular, licium-fallback, "Segoe UI", "Helvetica Neue", helvetica, arial, sans-serif;
  --heading-font-family: tajawal, tajawal-fallback, licium-medium, licium-medium-fallback, "Segoe UI", "Helvetica Neue", helvetica, arial, sans-serif;
}

/* Keep the page shell and component geometry RTL while resolving each authored
 * text paragraph from its own first strong character. English sentences then
 * retain LTR punctuation and wrapping; Arabic and mixed Arabic-first copy stay
 * RTL without authors having to add a direction field to every text property. */
html[dir="rtl"] :is(h1, h2, h3, h4, h5, h6, p, li, dt, dd, figcaption, blockquote, label, legend, summary, caption, td, th) {
  unicode-bidi: plaintext;
}

/* Measured against `التنقل الذكي للعائلات` at 32px after Tajawal's 112.5%
 * design adjustment. Matching every supplied weight keeps the fallback swap
 * width-stable instead of treating Arabic as one synthetic regular face. */
@font-face {
  font-family: tajawal-fallback;
  font-weight: 200;
  size-adjust: 136.442%;
  src: local('Arial');
  unicode-range:
    U+0600-06FF,
    U+0750-077F,
    U+0870-089F,
    U+08A0-08FF,
    U+FB50-FDFF,
    U+FE70-FEFF,
    U+1EE00-1EEFF;
}

@font-face {
  font-family: tajawal-fallback;
  font-weight: 300;
  size-adjust: 140.525%;
  src: local('Arial');
  unicode-range:
    U+0600-06FF,
    U+0750-077F,
    U+0870-089F,
    U+08A0-08FF,
    U+FB50-FDFF,
    U+FE70-FEFF,
    U+1EE00-1EEFF;
}

@font-face {
  font-family: tajawal-fallback;
  font-weight: 400;
  size-adjust: 146.445%;
  src: local('Arial');
  unicode-range:
    U+0600-06FF,
    U+0750-077F,
    U+0870-089F,
    U+08A0-08FF,
    U+FB50-FDFF,
    U+FE70-FEFF,
    U+1EE00-1EEFF;
}

@font-face {
  font-family: tajawal-fallback;
  font-weight: 500;
  size-adjust: 150.357%;
  src: local('Arial');
  unicode-range:
    U+0600-06FF,
    U+0750-077F,
    U+0870-089F,
    U+08A0-08FF,
    U+FB50-FDFF,
    U+FE70-FEFF,
    U+1EE00-1EEFF;
}

@font-face {
  font-family: tajawal-fallback;
  font-weight: 700;
  size-adjust: 159.366%;
  src: local('Arial');
  unicode-range:
    U+0600-06FF,
    U+0750-077F,
    U+0870-089F,
    U+08A0-08FF,
    U+FB50-FDFF,
    U+FE70-FEFF,
    U+1EE00-1EEFF;
}

/*
 * licium ships from `fonts.css`, which loads after the eager section, so any
 * text painted before it lands is drawn in the next family on the stack. Without
 * a metric-matched stand-in that swap changes glyph widths and reflows the line:
 * measured over three sample strings, licium-regular is 107.916% of Arial and
 * licium-medium 110.613%, which on the white-header nav moved the whole row from
 * 429px to 452px in view. These two faces keep the pre-swap layout identical, so
 * it no longer matters whether a block paints before or after the font arrives.
 */
@font-face {
  font-family: licium-fallback;
  size-adjust: 107.916%;
  src: local('Arial');
}

@font-face {
  font-family: licium-medium-fallback;
  size-adjust: 110.613%;
  src: local('Arial');
}

@font-face {
  font-family: licium-fallback;
  font-weight: 400;
  size-adjust: 146.445%;
  src: local('Arial');
  unicode-range:
    U+0600-06FF,
    U+0750-077F,
    U+0870-089F,
    U+08A0-08FF,
    U+FB50-FDFF,
    U+FE70-FEFF,
    U+1EE00-1EEFF;
}

@font-face {
  font-family: licium-medium-fallback;
  font-weight: 400 500;
  size-adjust: 150.357%;
  src: local('Arial');
  unicode-range:
    U+0600-06FF,
    U+0750-077F,
    U+0870-089F,
    U+08A0-08FF,
    U+FB50-FDFF,
    U+FE70-FEFF,
    U+1EE00-1EEFF;
}

@media (width >= 900px) {
  :root {
    /* body sizes */
    --body-font-size-m: 18px;
    --body-font-size-s: 16px;
    --body-font-size-xs: 14px;

    /* heading sizes */
    --heading-font-size-xxl: 45px;
    --heading-font-size-xl: 36px;
    --heading-font-size-l: 28px;
    --heading-font-size-m: 22px;
    --heading-font-size-s: 20px;
    --heading-font-size-xs: 18px;
  }
}

body {
  display: none;
  margin: 0;
  background-color: var(--background-color);
  color: var(--text-color);
  font-family: var(--body-font-family);
  font-size: var(--body-font-size-m);
  line-height: 1.6;

  /* Match the live site's lighter glyph rendering (same licium font files). */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.appear {
  display: block;
}

header {
  height: var(--nav-height);
}

header .header,
footer .footer {
  visibility: hidden;
}

header .header[data-block-status="loaded"],
footer .footer[data-block-status="loaded"] {
  visibility: visible;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin-top: 0.8em;
  margin-bottom: 0.25em;
  font-family: var(--heading-font-family);
  font-weight: 600;
  line-height: 1.25;
  scroll-margin: 40px;
}

h1 { font-size: var(--heading-font-size-xxl); }
h2 { font-size: var(--heading-font-size-xl); }
h3 { font-size: var(--heading-font-size-l); }
h4 { font-size: var(--heading-font-size-m); }
h5 { font-size: var(--heading-font-size-s); }
h6 { font-size: var(--heading-font-size-xs); }

p,
dl,
ol,
ul,
pre,
blockquote {
  margin-top: 0.8em;
  margin-bottom: 0.25em;
}

code,
pre {
  font-size: var(--body-font-size-s);
}

pre {
  padding: 16px;
  border-radius: 8px;
  background-color: var(--light-color);
  overflow-x: auto;
  white-space: pre;
}

main > div {
  margin: 40px 16px;
}

input,
textarea,
select,
button {
  font: inherit;
}

/* links */
a:any-link {
  color: var(--link-color);
  text-decoration: none;
  overflow-wrap: break-word;
}

a:hover {
  color: var(--link-hover-color);
  text-decoration: underline;
}

/* buttons */
p.button-wrapper {
  margin: 12px 0;
}

a.button:any-link,
button.button {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  margin: 0;
  border: 2px solid transparent;
  border-radius: 2.4em;
  padding: 0.5em 1.2em;
  font: inherit;
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

a.button[aria-disabled="true"],
button.button:disabled {
  cursor: not-allowed;
  pointer-events: none;
}

a.button.primary,
button.button.primary {
  border-color: var(--text-color);
  background-color: var(--text-color);
  color: var(--background-color);
}

a.button.primary:hover,
a.button.primary:focus-visible,
button.button.primary:hover,
button.button.primary:focus-visible {
  border-color: var(--dark-color);
  background-color: var(--dark-color);
  color: var(--light-color);
}

a.button.primary[aria-disabled="true"],
a.button.primary[aria-disabled="true"]:hover,
a.button.primary[aria-disabled="true"]:focus-visible,
button.button.primary:disabled,
button.button.primary:disabled:hover,
button.button.primary:disabled:focus-visible {
  background-color: var(--light-color);
  border-color: var(--light-color);
  color: var(--dark-color);
}

a.button.secondary,
button.button.secondary {
  border-color: var(--text-color);
  background-color: transparent;
  color: var(--text-color);
}

a.button.secondary:hover,
a.button.secondary:focus-visible,
button.button.secondary:hover,
button.button.secondary:focus-visible {
  border-color: var(--dark-color);
  background-color: var(--light-color);
  color: var(--dark-color);
}

a.button.secondary[aria-disabled="true"],
a.button.secondary[aria-disabled="true"]:hover,
a.button.secondary[aria-disabled="true"]:focus-visible,
button.button.secondary:disabled,
button.button.secondary:disabled:hover,
button.button.secondary:disabled:focus-visible {
  background-color: var(--light-color);
  border-color: var(--light-color);
  color: var(--dark-color);
}

/* high-impact call-to-action */
a.button.accent,
button.button.accent {
  border-color: var(--link-color);
  background-color: var(--link-color);
  color: var(--background-color);
}

a.button.accent:hover,
a.button.accent:focus-visible,
button.button.accent:hover,
button.button.accent:focus-visible {
  border-color: var(--link-hover-color);
  background-color: var(--link-hover-color);
}

a.button.accent[aria-disabled="true"],
a.button.accent[aria-disabled="true"]:hover,
a.button.accent[aria-disabled="true"]:focus-visible,
button.button.accent:disabled,
button.button.accent:disabled:hover,
button.button.accent:disabled:focus-visible {
  background-color: var(--light-color);
  border-color: var(--light-color);
  color: var(--dark-color);
}

main img {
  max-width: 100%;
  width: auto;
  height: auto;
}

.icon {
  display: inline-block;
  height: 24px;
  width: 24px;
}

.icon img {
  height: 100%;
  width: 100%;
}

/* sections */
main > .section {
  margin: 40px 0;
}

main > .section > div {
  max-width: 1200px;
  margin: auto;
  padding: 0 24px;
}

main > .section:first-of-type {
  margin-top: 0;
}

@media (width >= 900px) {
  main > .section > div {
    padding: 0 32px;
  }
}

/* section metadata */
main .section.light,
main .section.highlight {
  background-color: var(--light-color);
  margin: 0;
  padding: 40px 0;
}

/* about us blocks render in LiciumFont like the live site */
main [data-about-block],
main [data-about-block] p {
  font-family: licium-regular, licium-fallback, sans-serif;
}

main [data-about-block] h1,
main [data-about-block] h2,
main [data-about-block] h3 {
  font-family: licium-medium, licium-medium-fallback, sans-serif;
}

/* production renders operating captions in licium-medium on desktop (721px and up) */
@media (width >= 721px) {
  main .lixiang-about-creativity-card-description,
  main .lixiang-about-creativity-card-description p,
  main .lixiang-about-creativity-values-description,
  main .lixiang-about-creativity-values-description p {
    font-family: licium-medium, licium-medium-fallback, sans-serif;
  }
}

main .lixiang-about-vehicle-model-name {
  font-family: licium-medium, licium-medium-fallback, sans-serif;
}

/* about us scroll/load motion matching the live site */
@media (prefers-reduced-motion: no-preference) {
  main [data-about-block] .about-anim {
    opacity: 0;
    transform: translate3d(0, 90px, 0);
    transition:
      opacity 0.8s linear,
      transform 0.8s cubic-bezier(0.26, 0.67, 0.48, 0.91);
    will-change: transform, opacity;
  }

  main [data-about-block].about-inview .about-anim {
    opacity: 1;
    transform: translateZ(0);
  }

  main [data-about-block] .about-anim-item {
    opacity: 0;
    transform: translate3d(0, 25px, 0);
    transition:
      transform 0.5s cubic-bezier(0.39, 0.575, 0.565, 1),
      opacity 0.3s ease-in;
    will-change: transform, opacity;
  }

  main [data-about-block].about-inview .about-anim-item {
    opacity: 1;
    transform: translateZ(0);
  }

  main [data-about-block].about-inview .about-anim-item:first-child { transition-delay: 0.3s; }
  main [data-about-block].about-inview .about-anim-item:nth-child(2) { transition-delay: 0.4s; }
  main [data-about-block].about-inview .about-anim-item:nth-child(3) { transition-delay: 0.5s; }
  main [data-about-block].about-inview .about-anim-item:nth-child(4) { transition-delay: 0.6s; }
  main [data-about-block].about-inview .about-anim-item:nth-child(5) { transition-delay: 0.7s; }
  main [data-about-block].about-inview .about-anim-item:nth-child(6) { transition-delay: 0.8s; }
}

/* about us page: single full-bleed section stacking lixiang-about blocks */
main > .section:has(> .lixiang-about-hero-wrapper) {
  margin: -50px 0 0;

  --about-scale: 1;
}

/* live keeps the fixed 50px header in normal flow only for the Pad shell */
@media (width >= 721px) and (width <= 850px) {
  main > .section:has(> .lixiang-about-hero-wrapper) { margin-top: 0; }
}

/* production fluid tiers: 1025-1440 = 0.75x, 721-1024 = vw/1344 */
@media (width > 1024px) and (width <= 1440px) {
  main > .section:has(> .lixiang-about-hero-wrapper) { --about-scale: 0.75; }
}

@media (width >= 721px) and (width <= 1024px) {
  main > .section:has(> .lixiang-about-hero-wrapper) { --about-scale: calc(100vw / 1344px); }
}

main > .section > [class*='lixiang-about-'][class$='-wrapper'] {
  max-width: unset;
  padding: 0;
}

/* legal text pages (terms, cookie policy): single centered richtext column */
main > .section.legal {
  margin: 0;
  font-family: licium-regular, licium-fallback, sans-serif;
  color: #222;
}

main > .section.legal > div {
  max-width: 1288px;
  padding: 40px 20px;
}

main > .section.legal h1 {
  margin: 0 0 60px;
  font-family: licium-medium, licium-medium-fallback, sans-serif;
  font-size: 28px;
  font-weight: 600;
  line-height: 40px;
  color: #222;
}

main > .section.legal h2 {
  margin: 60px 0 0;
  font-family: licium-medium, licium-medium-fallback, sans-serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 30px;
  color: #222;
}

main > .section.legal h3 {
  margin: 16px 0 0;
  font-family: licium-medium, licium-medium-fallback, sans-serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 24px;
  color: #222;
}

main > .section.legal p,
main > .section.legal ul,
main > .section.legal ol {
  margin: 16px 0 0;
  font-size: 14px;
  line-height: 24px;
}

main > .section.legal a:any-link {
  color: #5a7cab;
}

main > .section.legal a:hover {
  color: #5a7cab;
}

@media (width >= 900px) {
  main > .section.legal > div {
    padding: 60px 32px 80px;
  }

  main > .section.legal h1 {
    font-family: licium-regular, licium-fallback, sans-serif;
    font-size: 32px;
    font-weight: 400;
    line-height: 56px;
  }
}

/* Product pages can split long scene stacks into multiple authored sections without adding gaps. */
main:has(> .section > .lixiang-product-hero-wrapper) > .section {
  margin-block: 0;
}
