/*
 * Landing page (front-page.php)
 *
 * Desktop is drawn on a 1440 x 803 frame, mobile on 393 x 852.
 * --u is one design pixel, so every size below reads straight off Figma.
 */

body.oba-landing-page {
  margin: 0;
  overflow: hidden;
  background: var(--oba-black);
}

/* The landing page is full bleed: no site header on top of it. */
body.oba-landing-page .pos-f-t {
  display: none;
}

.oba-landing {
  --u: min(calc(100vw / 1440), calc(100vh / 620));

  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  background: var(--oba-black);
  font-weight: 400;
  text-transform: none;
  -webkit-font-smoothing: antialiased;
}

/* Logged-in editors: stay clear of the WordPress admin bar. */
body.admin-bar .oba-landing {
  top: 32px;
}

@media screen and (max-width: 782px) {
  body.admin-bar .oba-landing {
    top: 46px;
  }
}

.oba-landing__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Panels ---------- */

.oba-landing__panel {
  position: relative;
  flex: 1 1 50%;
  display: flex;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  /* The whole tile is a click target: it opens the brand's menu. */
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.oba-landing__panel--dark {
  background: var(--oba-black);
  color: var(--oba-white);
}

.oba-landing__panel--light {
  background: var(--oba-white);
  color: var(--oba-black);
}

.oba-landing__field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

/* Logo column: logo sits 40px from the centre line. */
.oba-landing__brand {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(126 * var(--u));
}

.oba-landing__panel--light .oba-landing__brand {
  order: -1;
  width: calc(132 * var(--u));
}

.oba-landing .oba-landing__logo {
  all: unset;
  position: relative;
  z-index: 2;
  display: block;
  box-sizing: border-box;
  cursor: pointer;
  line-height: 0;
  transition: transform 0.3s ease;
}

.oba-landing .oba-landing__logo img {
  display: block;
  width: calc(46 * var(--u));
  max-width: none;
  height: auto;
}

.oba-landing .oba-landing__panel--light .oba-landing__logo img {
  width: calc(52 * var(--u));
}

.oba-landing .oba-landing__logo:focus-visible,
.oba-landing .oba-landing__more:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 6px;
}

/* ---------- Dots ---------- */

.oba-landing__dots {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.oba-landing__dots--mobile {
  display: none;
}

.oba-landing__dot {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: calc(var(--d) * var(--u));
  height: calc(var(--d) * var(--u));
  border-radius: 50%;
  background: currentColor;
  transform: translate(-50%, -50%) scale(1);
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.3, 0, 0.2, 1);
}

.oba-landing__panel.is-open .oba-landing__dot {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.6);
}

/* ---------- Word, arrow, description ---------- */

/* Text is centred in the side minus the 80px margin at the centre line. */
.oba-landing__content {
  position: absolute;
  inset: 0 calc(80 * var(--u)) 0 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.oba-landing__panel--light .oba-landing__content {
  inset: 0 0 0 calc(80 * var(--u));
}

.oba-landing__word,
.oba-landing__description {
  grid-area: 1 / 1;
  margin: 0;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.4s ease;
}

.oba-landing__word {
  font-family: var(--oba-font-special);
  font-size: calc(85 * var(--u));
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  transform: translateY(calc(8 * var(--u)));
}

.oba-landing__description {
  /*
   * Figma sets this in macOS Futura Medium in a 354px box. The supplied
   * futura-med.otf runs about 12% narrower, so the box is narrowed by the same
   * amount to keep the line breaks of the design.
   */
  width: 15.5em;
  max-width: calc(100% - 40px);
  font-family: var(--oba-font-body);
  font-size: max(15px, calc(20 * var(--u)));
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: 0;
  text-align: center;
  transform: translateY(calc(8 * var(--u)));
}

.oba-landing .oba-landing__more {
  all: unset;
  position: absolute;
  left: 50%;
  top: 79.7%;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  color: inherit;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.oba-landing__chevron {
  display: block;
  width: calc(20 * var(--u));
  height: auto;
  overflow: visible;
}

/* The theme fills every svg with the text colour: this one is a stroke only. */
.oba-landing .oba-landing__chevron path {
  fill: none;
  stroke: currentColor;
}

/* Open: the word and the arrow. */
.oba-landing__panel.is-open:not(.is-reading) .oba-landing__word {
  opacity: 1;
  transform: none;
  transition-delay: 0.12s;
}

.oba-landing__panel.is-open:not(.is-reading) .oba-landing__more {
  opacity: 1;
  pointer-events: auto;
  transition-delay: 0.2s;
}

/* Reading: the description takes the place of the word. */
.oba-landing__panel.is-reading .oba-landing__description {
  opacity: 1;
  transform: none;
  transition-delay: 0.12s;
}

/* Without JavaScript the word still appears on hover. */
@media (hover: hover) and (pointer: fine) {
  .oba-landing:not(.is-ready) .oba-landing__panel:hover .oba-landing__dot {
    opacity: 0;
  }

  .oba-landing:not(.is-ready) .oba-landing__panel:hover .oba-landing__word {
    opacity: 1;
    transform: none;
  }

  .oba-landing .oba-landing__logo:hover {
    transform: scale(1.04);
  }
}

/* ---------- Mobile: halves stack, logos lie along the dividing line ---------- */

@media (max-width: 767px) {
  .oba-landing {
    --u: min(calc(100vw / 393), calc(100vh / 700));

    flex-direction: column;
  }

  .oba-landing__panel {
    flex-direction: column;
  }

  .oba-landing__dots--desktop {
    display: none;
  }

  .oba-landing__dots--mobile {
    display: block;
  }

  .oba-landing__brand,
  .oba-landing__panel--light .oba-landing__brand {
    width: 100%;
    padding: calc(20 * var(--u)) 0;
  }

  .oba-landing .oba-landing__logo img,
  .oba-landing .oba-landing__panel--light .oba-landing__logo img {
    width: calc(313 * var(--u));
  }

  .oba-landing__content,
  .oba-landing__panel--light .oba-landing__content {
    inset: 0;
  }

  .oba-landing__word {
    font-size: calc(60 * var(--u));
  }

  .oba-landing__description {
    width: calc(238 * var(--u));
    max-width: none;
    font-size: calc(18 * var(--u));
    line-height: 1.167;
  }

  .oba-landing .oba-landing__more {
    top: calc(50% + 54 * var(--u));
  }

  .oba-landing__chevron {
    width: calc(16.5 * var(--u));
  }
}

/*
 * Phone browsers count the space under their toolbars in 100vh, so on a short
 * screen (iPhone SE) the page is drawn for more height than is visible.
 * 100dvh is the height actually on screen.
 */
@supports (height: 100dvh) {
  @media (max-width: 767px) {
    .oba-landing {
      --u: min(calc(100vw / 393), calc(100dvh / 700));
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .oba-landing__dot,
  .oba-landing__word,
  .oba-landing__description,
  .oba-landing .oba-landing__more,
  .oba-landing .oba-landing__logo {
    transition-duration: 0.01s;
    transition-delay: 0s !important;
  }

  .oba-landing__panel.is-open .oba-landing__dot {
    transform: translate(-50%, -50%);
  }

  .oba-landing__word,
  .oba-landing__description {
    transform: none;
  }
}
