/* Copyright 2026 The Chromium Authors
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file. */

/* #css_wrapper_metadata_start
 * #type=style-lit
 * #import=chrome://resources/cr_elements/cr_hidden_style_lit.css.js
 * #import=chrome://resources/cr_elements/cr_icons_lit.css.js
 * #import=chrome://resources/cr_elements/cr_shared_vars.css.js
 * #scheme=relative
 * #include=cr-icons-lit cr-hidden-style-lit
 * #css_wrapper_metadata_end */

:host {
  --card-background-color: var(--cr-fallback-color-surface);
  --card-icon-background-color: var(--cr-fallback-color-on-surface);
  --card-bottom-padding: 1.5rem;
  --card-description-color: var(--cr-secondary-text-color);
  --card-description-font-size: 0.81rem;
  --card-horizontal-padding: 1.5rem;
  --card-horizontal-size:
      calc(var(--card-width) + 2 * var(--card-horizontal-padding));
  --card-title-font-size: 0.94rem;
  --card-top-padding: 1.5rem;
  --card-width: 11.75rem;
  --content-width:
      calc(3 * var(--card-horizontal-size) + 2 * var(--gap-between-cards));
  --disclaimer-border-color: var(--cr-fallback-color-surface-variant);
  --disclaimer-color: var(--google-grey-700);
  --gap-between-cards: 0.75rem;
  --product-logo-size: 72px;
  align-items: center;
  box-sizing: border-box;
  color: var(--cr-primary-text-color);
  display: flex;
  flex-direction: column;
  gap: 3rem;
  height: 100%;
  justify-content: center;
  overflow-y: auto;
  text-align: center;
}

@media (prefers-color-scheme: dark) {
  :host {
    --card-background-color: var(--cr-fallback-color-surface2);
    --card-description-color: var(--cr-fallback-color-on-surface);
    --disclaimer-border-color: var(--google-grey-600);
    --disclaimer-color: var(--google-grey-100);
  }
}

@media screen and ((max-width: 780px) or (max-height: 600px)) {
  :host {
    --card-description-font-size: 0.75rem;
    --card-title-font-size: 0.81rem;
    --card-width: 152px;
    --product-logo-size: 48px;
    gap: 1.5rem;
  }
}

@media screen and (max-width: 780px) {
  :host {
    --card-horizontal-padding: 8px;
  }
}

@media screen and (max-height: 600px) {
  :host {
    --card-bottom-padding: 12px;
    --card-top-padding: 15px;
  }
}

@media screen and ((max-width: 900px) or (max-height: 650px)) {
  .animation {
    display: none;
  }
}

@keyframes fade-in-animation {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 100%;
  }
}

p {
  margin: 0;
}

.animation {
  position: fixed;
  z-index: -1;
  pointer-events: none;
}

#leftAnimation {
  top: 35%;
  /* Check how much space is between 50% of screen width and 50% of content
   * width, then subtract 100% of the animation's size (arbitrary value) to push
   * it to the edge of the content. If the result is positive, min it with 0 to
   * prevent the animation from being pulled from left edge to the center. */
  transform: translate(
    min(0px, calc(50vw - var(--content-width) / 2 - 100%)),
    -50%);
  left: 0;
  height: 62.5vh;
  aspect-ratio: 288 / 620; /* To prevent cr-lottie from adding white padding. */
}

#rightAnimation {
  top: 50%;
  /* First push the animation by 70%  (arbitrary value) of its size and check
   * how much space is between 50% of screen width and 50% of content width.
   * Dividing by 2 makes the animation push out smoother, 1px of animation size
   * for every 2px of space shrank.
   * Everything is maxed with 0 to prevent the animation from being pulled
   * from the right edge to the center of the screen. */
  transform: translate(
    max(0px, calc(70% - (50vw - var(--content-width) / 2) / 2)),
    -50%);
  right: 0;
  height: 65vh;
  width: auto;
  aspect-ratio: 311 / 657;
}

#bottomAnimation {
  bottom: -5px;
  left: 20%;
  /* First push the animation by 50% of its size and check how much space is
   * between 50% of screen height and 300px (arbitrary value, around half of
   * the screen height we cut out the animations at).
   * Dividing it by 2 makes the animation push out smoother, 1px of animation
   * for every 2px of space shrank.
   * Everything is maxed with 0 to prevent the animation from being
   * pushed out of the bottom edge to the center of the screen. */
  transform: translate(-50%, max(0px, calc(50% - (50vh - 300px) / 2)));
  width: 40vw;
  height: auto;
  aspect-ratio: 600 / 215;
}

/* For RTL languages, flip the direction */
:host-context([dir=rtl]) #left-animation {
  left: auto;
  right: 0;
  transform: scaleX(-1) translate(
    min(0px, calc(50vw - var(--content-width) / 2 - 100%)),
    -50%);
}

:host-context([dir=rtl]) #right-animation {
  left: 0;
  right: auto;
  transform: scaleX(-1) translate(
    max(0px, calc(70% - (50vw - var(--content-width) / 2) / 2)),
    -50%);
}

:host-context([dir=rtl]) #bottom-animation {
  left: auto;
  right: 20%;
  transform: scaleX(-1) translate(-50%, max(0px, calc(50% - (50vh - 300px) / 2)));
}

.title {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0;
  max-width: var(--content-width);
}

h2 {
  font-size: var(--card-title-font-size);
  font-weight: 500;
  line-height: 22px;
  margin: 0;
}

.fade-in {
  animation: fade-in-animation 500ms ease-in-out;
}

.fast-fade-in {
  animation: fade-in-animation 300ms ease-in-out;
}

#product-logo-container {
  width: var(--product-logo-size);
  height: var(--product-logo-size);
}

#textContainer  {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: var(--content-width);
}

@media screen and ((max-width: 780px) or (max-height: 600px)) {
  .title {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 0.81rem;
  }

   #textContainer {
    gap: 1rem;
  }
}

#product-logo-animation {
  /* Because 50% of the svg file is the padding, we scale it by 2. */
  height: calc(var(--product-logo-size) * 2);
  width: calc(var(--product-logo-size) * 2);
  /* Center the ball exactly in the middle of the parent container. */
  transform: translate(-25%, -25%);
}

:host-context([dir=rtl]) #product-logo-animation {
  transform: translate(25%, -25%);
}

#benefitCardsContainer {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: var(--gap-between-cards);
}

.benefit-card {
  align-items: center;
  background: var(--card-background-color);
  border-radius: 1.5rem;
  box-shadow: 0 1px 5px 0 rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: var(--card-top-padding) var(--card-horizontal-padding)
      var(--card-bottom-padding);
  width: var(--card-width);
}

.benefit-card-description {
  color: var(--card-description-color);
  font-size: var(--card-description-font-size);
  font-weight: 400;
  line-height: 20px;
}

#buttonRow {
  align-items: center;
  display: flex;
  flex-direction: column;
}

#buttonContainer {
  display: flex;
  flex-direction: row;
  gap: 12px;
  justify-content: center;
}

.tangible-button {
  min-width: 133px;
}

#managedDeviceDisclaimer {
  align-items: center;
  align-self: stretch;
  border: 1px solid var(--disclaimer-border-color);
  border-radius: 1.5rem;
  box-sizing: border-box;
  color: var(--disclaimer-color);
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
  padding: 1.5rem;
  max-width: var(--content-width);

  font-size: var(--card-description-font-size);
}

#managedDeviceDisclaimer.temporarily-hidden {
  visibility: hidden;
}

#managedDeviceDisclaimer > p {
  flex-grow: 1;
  text-align: start;
}

#iconContainer {
  --icon-container-size: 20px;
  border-radius: 50%;
  height: var(--icon-container-size);
  width: var(--icon-container-size);
}

#iconContainer cr-icon {
  --iron-icon-width: 20px;
  --iron-icon-height: 20px;
  top: 50%;
  transform: translateY(-50%);
}

#security {
  <if expr="not _google_chrome">
  --cr-icon-image: url(images/security_old.svg);
  </if>
  <if expr="_google_chrome">
  --cr-icon-image: url(images/gshield.svg);
  </if>
}

#devices {
  --cr-icon-image: url(images/devices_old.svg);
}

#cloud-upload {
  --cr-icon-image: url(images/cloud_upload_old.svg);
}

.cr-icon {
  --cr-icon-size: 36px;
  background-color: var(--card-icon-background-color);
  margin: 0;
}

/* Prevent the icons from being flipped in RTL mode. */
:host-context([dir=rtl]) .cr-icon {
  transform: scaleX(1);
}

#top-right-corner-container {
  inset-inline-end: 1.5rem;
  position: absolute;
  top: 1.5rem;
}

#top-right-corner-container.has-effects-control-button {
  align-items: center;
  display: flex;
  flex-direction: row;
  /* Native: 16px toolbar padding + 28px button width + 6px separator margin
   * = 50px. */
  inset-inline-end: 50px;
  /* Align vertically with the native toolbar (8px padding). */
  top: 8px;
}

#declineSignInButton.no-border {
  --cr-button-background-color: transparent;
  --cr-button-border: none;
  background-color: transparent;
  border: none;
  box-shadow: none;
  min-width: 0;
   /* Native: 6px toolbar padding + 8px label margin = 14px horizontal. */
  padding: 6px 14px;
}

#separator {
  background-color: var(--color-sys-divider, var(--cr-fallback-color-divider));
  height: 16px;
  margin-inline-end: 6px;
  margin-inline-start: 2px;
  /* Fine-tune vertical alignment to perfectly match native. */
  transform: translateY(-1px);
  width: 2px;
}

#create-account-disclaimer {
  color: var(--cr-secondary-text-color);
  font-size: var(--card-description-font-size);
  margin-bottom: 1rem;
}

:host-context([webui-rounded-icons]) {
  #devices {
    --cr-icon-image: url(images/devices.svg);
  }

  #cloud-upload {
    --cr-icon-image: url(images/cloud_upload.svg);
  }

  <if expr="not _google_chrome">
  #security {
    --cr-icon-image: url(images/security.svg);
  }
  </if>
}
