/* Home intro: white loader (image sequence) -> ELLA [logo] VENNICE -> on scroll the black floods out of the
   logo box, the emblem grows into place and the original opener (emblem + white "Ella Vennice") takes over.
   Loaded after theme.css on index.html only. Driven by js/motion/intro.js. */

.hero {
  --hero-ink: #0a0a0a;
  --hero-bg: #ffffff;
  --hfs: min(9vw, 24svh);
  --load-box: clamp(64px, 6.4vw, 104px);
  position: relative;
  height: 300svh;
  background: var(--hero-bg);
}
.hero__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh; /* iPhone: the visible screen, so the line at the bottom is never under Safari's toolbar */
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--hero-bg);
  color: var(--hero-ink);
}
.hero__stage > .sys,
.hero__foot .sys,
.hero__label {
  color: var(--hero-ink);
}

/* Side labels */
.hero__label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
  z-index: 3;
}
.hero__label--l {
  left: var(--gut);
}
.hero__label--r {
  right: var(--gut);
}

/* Wordmark: the box is always dead centre, ELLA sits flush right against it, VENNICE flush left */
.hero__name {
  position: relative;
  width: 100%;
  padding: 0 var(--gut);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: .12em;
  font-family: "Newsreader", var(--display);
  font-weight: 600;
  font-size: var(--hfs);
  line-height: .8;
  letter-spacing: -.01em;
  text-transform: uppercase;
  color: var(--hero-ink);
  white-space: nowrap;
}
.hero__w {
  display: block;
  overflow: clip;
  padding: .22em .08em .16em;
  margin: -.22em -.08em -.16em;
  perspective: 600px;
}
.hero__w--l {
  justify-self: end;
}
.hero__w--r {
  justify-self: start;
}
.hero__ch {
  display: inline-block;
  transform-origin: 50% 100%;
  backface-visibility: hidden;
}

/* The square: holds the image sequence, then carries the emblem into the opener */
.hero__box {
  position: relative;
  display: block;
  width: .9em;
  height: .9em;
  margin-top: -.04em;
  background: #000;
  overflow: hidden;
  z-index: 5;
  transform-origin: 50% 50%;
}
.hero__box img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
}
.hero__box img.is-on {
  opacity: 1;
}

/* Loading: only the small square, labels and counter */
.hero.is-loading .hero__w {
  visibility: hidden;
}
.hero.is-loading .hero__box {
  width: var(--load-box);
  height: var(--load-box);
  margin: 0;
}

/* The black that floods out of the box (clip-path driven from JS) */
.hero__fill {
  position: absolute;
  inset: 0;
  background: #000;
  z-index: 2;
  clip-path: inset(50% 50% 50% 50%);
  pointer-events: none;
}

/* Counter */
.hero__n {
  position: absolute;
  left: 50%;
  bottom: clamp(24px, 5vh, 48px);
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: .2em;
  font-variant-numeric: tabular-nums;
}
.hero:not(.is-loading) .hero__n {
  opacity: 0;
}

/* Foot row on the white wordmark */
.hero__foot {
  position: absolute;
  left: var(--gut);
  right: var(--gut);
  bottom: clamp(20px, 3.4vh, 32px);
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: 0;
  z-index: 1;
}

/* End state: the original opener layout, revealed over the black */
.hero__end.opener {
  position: absolute;
  inset: 0;
  z-index: 4;
  min-height: 0;
  height: 100%;
  width: 100%;
  background: transparent;
  color: var(--ink);
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  visibility: hidden;
}
.hero__end .opener__chrome {
  filter: none;
}
.hero__end .opener__name {
  grid-row: 3;
}
.hero__end .opener__foot {
  grid-row: 4;
}

/* While the page is still white, keep the black nav and section rail out of the way */
.nav,
.rail {
  transition: opacity .5s var(--e, ease), visibility .5s;
}
html.hero-white .nav,
html.hero-white .rail {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
html.hero-lock,
html.hero-lock body {
  overflow: hidden;
}

/* No motion: skip straight to the opener */
.hero.is-static {
  height: auto;
}
.hero.is-static .hero__stage {
  position: relative;
  background: #000;
}
.hero.is-static .hero__stage > :not(.hero__end) {
  display: none;
}
.hero.is-static .hero__end {
  position: relative;
  visibility: visible;
  min-height: 100svh;
}

@media (max-width:1024px) {
  .hero {
    --load-box: 60px;
  }
  .hero__label {
    font-size: 10px;
    letter-spacing: .06em;
  }
  .hero__end.opener {
    grid-template-rows: auto minmax(0, 1fr) auto auto;
  }
}

/* Opener rows lost their centre items: keep the right-hand item in the right column */
.hero__end .opener__r {
  grid-column: 3;
}

/* Loader line at the bottom, in place of the counter (as in the reference) */
.hero__tag {
  position: absolute;
  left: 50%;
  bottom: clamp(24px, 5vh, 48px);
  width: min(420px, calc(100% - 2 * var(--gut)));
  margin: 0;
  transform: translateX(-50%);
  text-align: center;
  font-size: 13px;
  line-height: 1.45;
  color: var(--hero-ink);
  z-index: 3;
}
.hero:not(.is-loading) .hero__tag {
  opacity: 0;
}
.hero__label .ch {
  visibility: hidden;
}
.hero__label .ch.is-in {
  visibility: visible;
}

/* The stack that fans into a column and rises away when loading finishes */
.hero__col {
  position: absolute;
  z-index: 4;
  pointer-events: none;
}
.hero__ci {
  position: absolute;
  inset: 0;
  background: #000;
  overflow: hidden;
}
.hero__ci img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Black opener: the name is the same capitals wordmark as the white page */
.hero__end .hero__endname {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: -.01em;
  font-style: normal;
}

/* After the intro plays the hero is just the black opener: no scroll runway, nothing sticky */
.hero.is-done {
  height: 100vh;
  background: #000;
}
.hero.is-done .hero__stage {
  position: relative;
}

/* Neutralise the old hero rules in site.css (min-height runway, stage padding) */
.hero {
  min-height: 0;
}
.hero .hero__stage {
  padding: 0;
}

/* Black opener: a short intro under the emblem in place of the big name.
   "ELLA VENNICE" opens it in the wordmark capitals; the white page's letters land exactly here. */
.hero__end .hero__intro {
  grid-row: 3;
  justify-self: center;
  max-width: 44ch;
  margin: clamp(10px, 2vh, 22px) auto clamp(28px, 5vh, 56px);
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(18px, 1.55vw, 23px);
  line-height: 1.45;
  text-align: center;
  color: rgba(255, 255, 255, .8);
}
.hero__iw {
  display: inline-block;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: -.01em;
  color: #FFFFFF;
  line-height: .8;
  padding: .22em .08em .16em;
  margin: -.22em -.08em -.16em;
}
.hero__rest {
  display: inline;
}

/* Black page = the loader's layout in white: labels either side, the grit line at the bottom,
   the chrome emblem in the middle. */
.hero__end.opener {
  grid-template-rows: minmax(0, 1fr);
  padding-top: clamp(84px, 11vh, 120px);
  padding-bottom: clamp(84px, 12vh, 132px);
}
.hero__end .opener__mark {
  grid-row: 1;
  min-height: 0;
}
.hero__end .opener__chrome {
  height: min(100%, 46vw, 62vh);
}
.hero__elabel {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #FFFFFF;
  z-index: 2;
}
.hero__elabel--l {
  left: var(--gut);
}
.hero__elabel--r {
  right: var(--gut);
}
.hero__etag {
  position: absolute;
  left: 50%;
  bottom: clamp(24px, 5vh, 48px);
  width: min(420px, calc(100% - 2 * var(--gut)));
  margin: 0;
  transform: translateX(-50%);
  text-align: center;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(255, 255, 255, .86);
}
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
@media (max-width: 1024px) {
  /* Phones: the labels sit either side of the emblem, level with its centre, one word per line */
  .hero__elabel {
    top: calc(50% + (clamp(84px, 11vh, 120px) - clamp(84px, 12vh, 132px)) / 2);
    font-size: 10px;
    line-height: 1.6;
    white-space: normal;
    width: min-content;
  }
  .hero__elabel--r {
    text-align: right;
  }
}

/* The liquid logo shows its own still image with visibility forced on, so hiding the black page
   with visibility is not enough: keep the emblem transparent until the intro hands over to it
   (intro.js sets it to opacity 1 when the box lands in its place). */
.hero__end .opener__chrome {
  opacity: 0;
}
.hero.is-static .hero__end .opener__chrome {
  opacity: 1;
}

/* Tablets: the labels and the line under the emblem at a size that suits the larger screen */
@media (min-width: 761px) and (max-width: 1024px) {
  .hero__elabel,
  .hero__label { font-size: 15px; letter-spacing: .1em; }
  .hero__etag { font-size: 20px; width: min(600px, calc(100% - 2 * var(--gut))); bottom: clamp(40px, 7vh, 80px); }
  .hero__tag { font-size: 20px; }
}

/* Laptops and up: the two labels and the line under the emblem, larger and growing with the screen
   so they still read on big monitors and TVs */
@media (min-width: 1600px) {
  /* the loading screen's own labels and line (.hero__label, .hero__tag) match the home page's exactly */
  .hero__elabel,
  .hero__label { font-size: clamp(15px, .9vw, 26px); letter-spacing: .1em; }
  .hero__tag,
  .hero__etag {
    font-size: clamp(20px, 1.3vw, 32px);
    width: min(28em, calc(100% - 2 * var(--gut)));
    bottom: clamp(40px, 7vh, 110px);
  }
}
