/*
 * PitaPass: "Get the app" page (/apps). Loaded on that page only. Classes use the pp2a- prefix.
 * Follows DESIGN.md v2: Night hero, Righteous poster type, the ticket as the object.
 * One object, one verb: pick who you are, and the phone opens that app.
 * Motion is transform and opacity only, and all of it sits behind prefers-reduced-motion.
 */

/* ---------- Hero ---------- */
/* On a phone the picker sits beside the phone it controls, so a tap and its answer are seen together */
.pp2a-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title title"
    "lead lead"
    "pick phone";
  column-gap: 14px;
  align-items: center;
}

.pp2a-hero__title {
  grid-area: title;
  font-size: clamp(46px, 12.4vw, 104px);
}

.pp2a-hero .pp2-hero__lead {
  grid-area: lead;
}

.pp2a-pick {
  grid-area: pick;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pp2a-pick a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 16px;
  border: 1.5px solid rgb(255 255 255 / 0.55);
  border-radius: 999px;
  color: #fff;
  font: 600 16px/1 var(--pp-font-ui);
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.pp2a-pick a:hover {
  border-color: #fff;
  background: rgb(255 255 255 / 0.08);
  color: #fff;
}

.pp2a-pick a:active {
  transform: scale(0.97);
}

.pp2a-pick a[aria-current="true"],
.pp2a-pick a[aria-current="true"]:hover {
  border-color: var(--pp-sunrise);
  background: var(--pp-sunrise);
  color: var(--pp-night);
}

/* ---------- The phone: each app's real opening screen ---------- */
.pp2a-phone {
  grid-area: phone;
  justify-self: center;
  width: min(37vw, 150px);
  aspect-ratio: 384 / 784;
  padding: 3.2%;
  border-radius: 16% / 7.8%;
  background: #211d36;
  box-shadow: inset 0 0 0 1.5px rgb(255 255 255 / 0.16), 0 28px 56px rgb(5 3 15 / 0.5);
  transform: rotate(3deg);
  transition: transform 0.5s var(--pp-ease-out);
}

.pp2a-phone:hover {
  transform: rotate(0deg);
}

.pp2a-phone__screen {
  position: relative;
  height: 100%;
  overflow: hidden;
  border-radius: 14% / 6.8%;
  background: var(--pp-night);
  container-type: inline-size;
}

.pp2a-phone__notch {
  position: absolute;
  z-index: 2;
  top: 5%;
  left: 50%;
  width: 32%;
  height: 3.4%;
  border-radius: 999px;
  background: #0a0716;
  transform: translateX(-50%);
}

.pp2a-screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease, visibility 0s 0.3s;
}

.pp2a-screen[data-on] {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.pp2a-screen--buyers {
  background: var(--pp-tanzanite);
}

.pp2a-screen--organizers {
  background: #fdfdfd;
}

.pp2a-screen--gate {
  background: var(--pp-night);
}

.pp2a-screen__mark {
  position: relative;
  width: 36%;
  height: auto;
  margin-bottom: 8%;
  overflow: visible;
}

.pp2a-screen--buyers .pp2a-screen__mark {
  width: 28%;
}

.pp2a-screen__name {
  position: absolute;
  right: 0;
  bottom: 7.5%;
  left: 0;
  color: #fff;
  font: 400 20px/1 var(--pp-font-display);
  font-size: 9cqw;
  text-align: center;
}

.pp2a-screen__name b {
  font-weight: 400;
}

.pp2a-screen__name small {
  display: block;
  margin-top: 0.35em;
  font: 500 12px/1 var(--pp-font-ui);
  font-size: 5.2cqw;
}

.pp2a-screen--organizers .pp2a-screen__name {
  color: var(--pp-tanzanite);
}

.pp2a-screen--organizers .pp2a-screen__name b {
  color: var(--pp-night);
}

.pp2a-screen--organizers .pp2a-screen__name small {
  color: var(--pp-ink-2);
}

.pp2a-screen--gate .pp2a-screen__name {
  color: var(--pp-tanzanite-light);
}

.pp2a-screen--gate .pp2a-screen__name b {
  color: #fff;
}

.pp2a-screen--gate .pp2a-screen__name small {
  color: var(--pp-sunrise);
}

/* The scan line only shows while it sweeps */
.pp2a-scanline {
  opacity: 0;
}

/* Snow on the buyers' opening screen: each fleck is a full-height column with a dot at its top */
.pp2a-snow {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pp2a-snow i {
  position: absolute;
  top: 0;
  left: var(--x);
  width: 5px;
  height: 100%;
  opacity: 0;
}

.pp2a-snow i::before {
  content: "";
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff;
}

.pp2a-snow i:nth-child(3n)::before {
  width: 5px;
  height: 5px;
}

.pp2a-snow i:nth-child(3n + 1)::before {
  width: 3px;
  height: 3px;
}

@media (prefers-reduced-motion: no-preference) {
  .pp2a-screen[data-on] .pp2a-screen__mark {
    animation: pp2a-open 0.5s var(--pp-ease-out) both;
  }

  .pp2a-screen[data-on] .pp2a-sun {
    animation: pp2a-rise 1.1s var(--pp-ease-out) 0.25s both;
  }

  .pp2a-screen[data-on] .pp2a-frame {
    transform-origin: 50px 50px;
    animation: pp2a-frame 0.6s var(--pp-ease-out) both;
  }

  .pp2a-screen[data-on] .pp2a-scanline {
    animation: pp2a-scan 1.3s ease-in-out 0.6s both;
  }

  /* Falls for a few seconds after the app opens, then the screen is still */
  .pp2a-screen[data-on] .pp2a-snow i {
    animation: pp2a-snow var(--d) linear var(--w) 3 both;
  }

  .pp2a--js .pp2a-pass[data-on] {
    animation: pp2a-pass 0.4s var(--pp-ease-out) both;
  }
}

@keyframes pp2a-open {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
}

@keyframes pp2a-rise {
  from {
    transform: translateY(9px);
  }
}

@keyframes pp2a-frame {
  from {
    opacity: 0;
    transform: scale(1.18);
  }
}

@keyframes pp2a-scan {
  0% {
    opacity: 0;
    transform: translateY(-27px);
  }

  15%,
  85% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translateY(27px);
  }
}

@keyframes pp2a-snow {
  0% {
    opacity: 0;
    transform: translate3d(0, -4%, 0);
  }

  12%,
  80% {
    opacity: 0.85;
  }

  100% {
    opacity: 0;
    transform: translate3d(8px, 100%, 0);
  }
}

@keyframes pp2a-pass {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

/* ---------- The passes: Night ticket, Sunrise stub with the way in ---------- */
.pp2a-passes {
  padding: 56px 0 64px;
  background: var(--pp-paper);
}

.pp2a-pass {
  display: grid;
  overflow: hidden;
  border-radius: var(--pp-radius-card);
  color: #fff;
  scroll-margin-top: 96px;
}

.pp2a-pass + .pp2a-pass {
  margin-top: 20px;
}

/* With JS only the picked pass is shown; without it all of them are listed */
.pp2a--js .pp2a-pass:not([data-on]) {
  display: none;
}

.pp2a--js .pp2a-pass + .pp2a-pass {
  margin-top: 0;
}

.pp2a-pass__body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  padding: 28px 24px;
}

.pp2a-pass__icon {
  width: 72px;
  height: 72px;
  border-radius: 17px;
  box-shadow: 0 0 0 1.5px rgb(255 255 255 / 0.16);
}

.pp2a-pass__for {
  margin: 0 0 6px;
  color: var(--pp-sunrise);
  font-size: 15px;
  font-weight: 600;
}

.pp2a-pass__name {
  margin: 0 0 8px;
  color: #fff;
  font: 400 clamp(28px, 6.4vw, 44px) / 1 var(--pp-font-display);
}

.pp2a-pass__line {
  max-width: 42ch;
  margin: 0;
  color: rgb(255 255 255 / 0.82);
  font-size: 17px;
  line-height: 1.5;
}

.pp2a-pass__stub {
  --pp-focus: var(--pp-night);
  position: relative;
  display: grid;
  gap: 18px;
  align-content: center;
  padding: 24px;
  border-top: 2px dashed rgb(18 12 43 / 0.4);
  background: var(--pp-sunrise);
  color: var(--pp-night);
}

/* Punched notches where the stub tears off */
.pp2a-pass__stub::before,
.pp2a-pass__stub::after {
  content: "";
  position: absolute;
  top: -12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--pp-paper);
}

.pp2a-pass__stub::before {
  left: -11px;
}

.pp2a-pass__stub::after {
  right: -11px;
}

.pp2a-pass__stores {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pp2a-store {
  display: inline-flex;
  flex: 1 1 150px;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 20px;
  border-radius: 999px;
  background: var(--pp-night);
  color: #fff;
  font: 600 17px/1.1 var(--pp-font-ui);
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.12s ease;
}

.pp2a-store:hover {
  background: #2a1f57;
  color: #fff;
}

.pp2a-store:active {
  transform: scale(0.97);
}

.pp2a-store small {
  display: block;
  margin-bottom: 3px;
  color: rgb(255 255 255 / 0.8);
  font-size: 12px;
  font-weight: 400;
}

.pp2a-store .material-icons {
  font-size: 26px;
}

/* The visitor's own phone system comes first */
[data-pp-os="ios"] .pp2a-store--ios {
  order: -1;
}

/* The scan code is for people reading on a computer */
.pp2a-pass__qr {
  display: none;
}

.pp2a-pass__code {
  display: block;
  padding: 8px;
  border-radius: 12px;
  background: #fff;
  line-height: 0;
}

/* ---------- No app needed: a Sunrise band ---------- */
.pp2a-noapp {
  --pp-focus: var(--pp-night);
  padding: 64px 0;
  background: var(--pp-sunrise);
  color: var(--pp-night);
}

.pp2a-noapp__title {
  max-width: 13ch;
  margin: 0 0 14px;
  color: var(--pp-night);
  font: 400 clamp(38px, 8.6vw, 76px) / 0.98 var(--pp-font-display);
  text-wrap: balance;
}

.pp2a-noapp__text {
  max-width: 46ch;
  margin: 0 0 24px;
  font-size: 18px;
  line-height: 1.55;
}

.pp2a-noapp__btn,
.pp2a-noapp__btn:hover {
  background: var(--pp-night);
  color: #fff;
}

.pp2a-noapp__btn:hover {
  background: #2a1f57;
}

/* ---------- Event day: who needs which app ---------- */
.pp2a-day__title {
  max-width: 16ch;
  margin: 0 0 28px;
  color: var(--pp-night);
  font: 400 clamp(30px, 5.6vw, 52px) / 1.02 var(--pp-font-display);
  text-wrap: balance;
}

.pp2a-day__grid {
  display: grid;
  gap: 16px;
}

.pp2a-day__cell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 24px;
  border-radius: var(--pp-radius-card);
  background: var(--pp-mist);
  color: var(--pp-ink-2);
  font-size: 17px;
  line-height: 1.5;
  text-decoration: none;
}

.pp2a-day__cell:hover {
  color: var(--pp-ink-2);
}

.pp2a-day__cell--door {
  background: #fff0eb;
}

.pp2a-day__cell b {
  display: block;
  margin-bottom: 2px;
  color: var(--pp-night);
  font: 400 22px/1.15 var(--pp-font-display);
}

.pp2a-day__cell img {
  width: 64px;
  height: 64px;
  border-radius: 15px;
  box-shadow: 0 0 0 1px var(--pp-line);
  transition: transform 0.3s var(--pp-ease-out);
}

.pp2a-day__cell:hover img {
  transform: rotate(-6deg) scale(1.06);
}

/* ---------- Wider screens ---------- */
@media (min-width: 560px) {
  .pp2a-hero__grid {
    column-gap: 32px;
  }

  .pp2a-pick a {
    padding: 0 20px;
  }

  .pp2a-phone {
    width: 190px;
  }
}

@media (min-width: 760px) {
  .pp2a-day__grid {
    grid-template-columns: 1.35fr 1fr;
  }
}

@media (min-width: 860px) {
  .pp2a-pass {
    grid-template-columns: minmax(0, 1fr) 330px;
  }

  .pp2a-pass__body {
    gap: 28px;
    padding: 40px;
  }

  .pp2a-pass__icon {
    width: 96px;
    height: 96px;
    border-radius: 22px;
  }

  .pp2a-pass__stub {
    padding: 28px;
    border-top: 0;
    border-left: 2px dashed rgb(18 12 43 / 0.4);
  }

  .pp2a-pass__stub::before,
  .pp2a-pass__stub::after {
    right: auto;
    left: -12px;
  }

  .pp2a-pass__stub::before {
    top: -11px;
  }

  .pp2a-pass__stub::after {
    top: auto;
    bottom: -11px;
  }
}

@media (min-width: 860px) and (hover: hover) and (pointer: fine) {
  .pp2a-pass__qr {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    font-size: 14px;
    line-height: 1.4;
  }
}

@media (min-width: 992px) {
  .pp2a-hero {
    padding: 40px 0 52px;
  }

  .pp2a-passes {
    padding-top: 44px;
  }

  .pp2a-hero__grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
    /* The two empty rows share the spare height, so the words sit level with the middle of the phone */
    grid-template-rows: 1fr auto auto auto 1fr;
    grid-template-areas:
      ". phone"
      "title phone"
      "lead phone"
      "pick phone"
      ". phone";
    column-gap: 56px;
  }

  .pp2a-pick {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .pp2a-phone {
    width: 232px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pp2a-phone,
  .pp2a-screen,
  .pp2a-day__cell img {
    transition: none;
  }
}
