/* Assume that we’re running this in 4K@1x. If you’re running 1080p@2x, shrink everything down to 50% in the browser first. */

@font-face {
  font-family: SamsungOne;
  src: url(fonts/samsungone--400.ttf);
}

@font-face {
  font-family: SamsungOne;
  src: url(fonts/samsungone--700.ttf);
  font-weight: bold;
}

@font-face {
  font-family: "Samsung Sharp Sans";
  src: url(fonts/samsung-sharp-sans--medium.otf);
  font-weight: 500;
}

@font-face {
  font-family: "Samsung Sharp Sans";
  src: url(fonts/samsung-sharp-sans--bold.ttf);
  font-weight: bold;
}

:root {
  color-scheme: light dark;

  --color--text: hsl(240, 10%, 10%);
  --color--background: white;

  --color--text--link-unvisited: hsl(180, 100%, 25%);
  --color--text--link-visited: hsl(270, 100%, 25%);

  /* Dude and dots. */
  /* Width and height taken from Figma, not image intrinsics. */
  --dnd-width: calc(1530px);
  --dnd-height: calc(3075px);

  /* The tappable dots on the dude. */
  --dot-width: calc(160px / 1);
  --dot-height: calc(159px / 1);

  --purple: #1428a0;

  --gap-standard: 16px;

  -webkit-user-select: none;
  user-select: none;
}

html,
body {
  height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: url(backgrounds/greenscrub.png);
}

* {
  box-sizing: border-box;
}

html {
  font:
    500 2em/1.3 SamsungOne,
    system-ui,
    sans-serif;
  color: var(--color--text);
  background: #b0c3dd;
}

a:link {
  color: var(--color--text--link-unvisited);
}

a:visited {
  color: var(--color--text--link-visited);
}

.hidden {
  display: none;
}

/* BEM starts here */

.heading {
  position: absolute;
  bottom: calc(var(--dnd-height) - 50px);
  left: calc(100vw / 12 * 1);

  font:
    bold 1rem/1 "Samsung Sharp Sans",
    system-ui,
    sans-serif;

  color: black;

  & .heading__heading {
    font-size: 120px;
    line-height: 156.6px;
  }

  & .heading__subheading {
    font-size: 80px;
    line-height: 104.4px;
    font-weight: normal;
  }
}

.video-container {
  /* Toggle this to toggle video playback for testing */
  -display: none;

  & .video-container__overlay,
  & .video-container__video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
  }

  & .video-container__overlay {
    backdrop-filter: blur(10px) grayscale(30%);
    -background: rgba(48, 25, 52, 0.75);
  }

  & .video-container__video {
    object-fit: cover;
  }
}

.dude-and-dots {
  position: absolute;
  bottom: 0;
  left: -160px;

  width: var(--dnd-width);
  height: var(--dnd-height);

  & .dude-and-dots__dude {
    position: absolute;

    width: var(--dnd-width);
    height: var(--dnd-height);

    user-select: none;
    -webkit-user-drag: none;
  }

  /* Place the MRZR the same way as we place the dude */
  & .dude-and-dots__mrzr {
    position: absolute;
    bottom: 400px;
    left: 810px;

    user-select: none;
    -webkit-user-drag: none;
  }

  & .dude-and-dots__dot {
    position: absolute;
    width: var(--dot-width);
    height: var(--dot-height);

    animation: dot-pulse infinite 3s alternate ease-in-out;

    transition: opacity 3s; /* For dimming not-active dots */

    cursor: pointer;

    user-select: none;
    -webkit-user-drag: none;

    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  }

  & .dude-and-dots__dot[data-body-part="sky"] {
    bottom: calc(var(--dnd-height) * 45 / 50);
    left: calc(var(--dnd-width) * 10 / 50);
  }

  & .dude-and-dots__dot[data-body-part="radio"] {
    bottom: calc(var(--dnd-height) * 38 / 50);
    left: calc(var(--dnd-width) * 10 / 50);
  }

  & .dude-and-dots__dot[data-body-part="magazines"] {
    bottom: calc(var(--dnd-height) * 26 / 50);
    left: calc(var(--dnd-width) * 38 / 50);
  }

  & .dude-and-dots__dot[data-body-part="scapula"] {
    bottom: calc(var(--dnd-height) * 31 / 50);
    left: calc(var(--dnd-width) * 6 / 50);
  }

  & .dude-and-dots__dot[data-body-part="chest"] {
    bottom: calc(var(--dnd-height) * 31 / 50);
    left: calc(var(--dnd-width) * 30 / 50);
  }

  & .dude-and-dots__dot[data-body-part="wristputer"] {
    bottom: calc(var(--dnd-height) * 10 / 50);
    left: calc(var(--dnd-width) * 12 / 50);
  }

  & .dude-and-dots__dot[data-body-part="radio"] {
    bottom: calc(var(--dnd-height) * 25 / 50);
    left: calc(var(--dnd-width) * 25 / 50);
  }

  & .dude-and-dots__dot[data-body-part="cargo-pocket"] {
    bottom: calc(var(--dnd-height) * 1 / 50);
    left: calc(var(--dnd-width) * 25 / 50);
  }

  & .dude-and-dots__dot[data-body-part="mrzr"] {
    bottom: calc(var(--dnd-height) * 18 / 50);
    left: calc(var(--dnd-width) * 70 / 50);
  }
}

.dude-and-dots .dude-and-dots__dot {
  position: absolute;
  width: var(--dot-width);
  height: var(--dot-height);

  animation: dot-pulse infinite 3s alternate ease-in-out;

  transition: opacity 3s; /* For dimming not-active dots */

  cursor: pointer;

  user-select: none;
  -webkit-user-drag: none;
}

.dude-and-dots .dude-and-dots__dot[data-body-part="wristputer"] {
  bottom: calc(var(--dnd-height) * 10 / 50);
  left: calc(var(--dnd-width) * 12 / 50);
}

/* See NAMING.md for an overview. */
.popup {
  background: white;
  box-shadow: 0px 0px 40px 10px rgba(0, 0, 0, 0.1);
  border-radius: 12px;

  top: 838px;
  right: 199px;

  --popup-width: 776px;
  width: var(--popup-width);

  --popup-padding-block: 40px;
  --popup-padding-inline: 35px;

  padding: var(--popup-padding-block) var(--popup-padding-inline);

  & .popup__icon-close {
    position: absolute;

    top: 36px;
    right: 29px;

    width: fit-content;
    height: fit-content;

    cursor: pointer;

    user-select: none;
    -webkit-user-drag: none;

    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  }

  & .popup__container {
    display: grid;
  }
}

.popup--tap-prompt {
  position: absolute;

  contain: layout;

  font:
    500 50px/55px "Samsung Sharp Sans",
    sans-serif;

  & .popup--tap-prompt__container {
    display: flex;
    justify-content: flex-start;
    align-items: center;

    margin: calc(56px - var(--popup-padding-block))
      calc(34px - var(--popup-padding-inline));

    gap: 26px;
  }

  & .popup--tap-prompt__verbiage-first-line {
    /* can’t use `position` with ::first-line */
    position: relative;
    /* Samsung says to optically align left edges, so align the stems of T with t */
    left: -0.12em;
  }
}

.popup--list {
  position: absolute;

  & .popup__container {
    margin-top: 48px;
  }

  & .popup--list__entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 60px;
    -outline: thin dotted blue;
  }

  & .popup--list__logo {
    padding-right: 24px;
    -outline: thin solid green;
  }
}

.popup--details {
  position: absolute;

  & .popup--details__back-button {
    position: absolute;
    top: 41px;
    left: 42px;

    display: flex;
    gap: 16px;

    font:
      bold 30px/30px SamsungOne,
      sans-serif;
    user-select: none;
  }

  & .popup--details__container {
    --popup-details-padding-inline: 61px;
    padding: 60px var(--popup-details-padding-inline) 0;
  }

  & .popup--details__logo {
    display: block;
    margin: 60px auto;
  }

  & .popup--details__images {
    display: flex;
    justify-content: space-around;

    margin: 70px 0;

    gap: 27px;

    & img {
      width: 176px;
      height: 177px;
    }
  }

  & .popup--details__images-only-two {
    justify-content: center;
  }

  /* the only-one case doesn’t need extra work */

  & .popup--details__verbiage {
    margin: 70px 0;
  }

  & .popup--details__learn-more {
    margin-top: 60px;
    margin-bottom: calc(70px - var(--popup-padding-block));
    display: flex;
    justify-content: initial;
    align-items: center;
    gap: 37px;
  }

  & .popup--details__qr-code {
    height: 120px;
  }

  & .popup--details__code-prompt {
    font-size: 30px;
    font-weight: bold;
  }
}

.popup--video {
  top: revert;
  right: revert;
  width: revert;
  color: inherit;

  & .popup--video__verbiage {
    width: 2000px; /* same as video intrinsic size */
    h2 {
      text-align: center;
      margin-top: 0;
    }
  }

  & .popup--video__verbiage-inner {
    columns: 2;
    & p:first-child {
      margin-top: 0;
    }
  }

  &::backdrop {
    backdrop-filter: brightness(50%) blur(10px);
  }
}

@keyframes dot-pulse {
  0% {
    transform: scale(1);
  }

  100% {
    transform: scale(1.2);
  }
}
