/* ==========================================================================
   Miratorie — landing page
   Mobile-first. No build step and no framework; the only JavaScript is
   motion.js, which adds the video pause control.
   Every value worth arguing about lives in the custom properties below.
   ========================================================================== */

:root {
  /* Palette */
  --color-bg: #000000;
  --color-fg: #ffffff;
  --color-video-placeholder: #0e0e0e; /* shows behind a video before it paints */

  /* Type
   *
   * Georgia ships with macOS, Windows and iOS, so no webfont request. Android
   * is the gap — it has no Georgia and will land on the generic serif (Noto
   * Serif), which is narrower and a little lighter.
   */
  --font-family: Georgia, "Times New Roman", Times, serif;

  /* Layout */
  --page-gutter: 1.25rem;
  --content-max: 84rem;
  --header-height: 4.5rem;
  /* Just short of the full screen, so the section below peeks in. */
  --hero-height: 85svh;

  --logo-width: 40vw;
  --logo-min-width: 9rem;
  --logo-max-width: 15rem;
  /* How far the logo sits below the top of the page. */
  --logo-top-offset: clamp(2rem, 5vw, 3.5rem);
  /*
   * The scrim behind the logo: a black fade that is this opaque at the top of
   * the page and fully clear this far below the bottom of the logo.
   */
  --logo-scrim-opacity: 0.8;
  --logo-scrim-extent: 16rem;

  /*
   * Industries: the black wash that sits over each clip until it is hovered
   * or focused, and the label pinned to the bottom of the tile.
   */
  --industry-overlay-opacity: 0.7;
  --industry-overlay-duration: 250ms;
  --industry-label-size: clamp(1.375rem, 2.4vw, 2rem);
  --industry-label-offset: clamp(1.5rem, 4vw, 2.5rem);
  /* The underlined "see more" hint under the label on phones and tablets. */
  --industry-more-size: 0.9375rem;
  /* The wordmark floating over the strip of clips. */
  --industry-wordmark-width: clamp(12rem, 45vw, 28rem);
  /* One- and two-column layouts: how far below the top of the first row. */
  --industry-wordmark-top: clamp(2.5rem, 10vw, 4rem);

  /*
   * Subpages: the showreel is portrait (9:16). It runs edge to edge on a
   * phone, where that fills the screen, but on a wide screen it would be
   * several screens tall, so its height is capped and it sits centred instead.
   */
  --subpage-video-aspect: 9 / 16;
  --subpage-video-max-height: 85svh;
  /* Between the logo and the video, and between the video and the title. */
  --subpage-gap: clamp(1.5rem, 4vw, 3rem);
}

@media (min-width: 48em) {
  :root {
    --page-gutter: 2.5rem;
    --header-height: 5.5rem;
  }
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--color-bg);
  color: var(--color-fg);
  font-family: var(--font-family);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img,
video {
  display: block;
  max-width: 100%;
}

/* --------------------------------------------------------------------------
   Accessibility helpers
   -------------------------------------------------------------------------- */

/* Visible only once focused — lets keyboard users jump past the hero. */
.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  padding: 0.75rem 1rem;
  background-color: var(--color-fg);
  color: var(--color-bg);
  font-size: 1rem;
  text-decoration: none;
  transform: translateY(-100%);
}

.skip-link:focus {
  transform: translateY(0);
}

:where(a, button, video):focus-visible {
  outline: 2px solid var(--color-fg);
  outline-offset: 4px;
}

/* --------------------------------------------------------------------------
   Header — logo, overlaid on the hero
   -------------------------------------------------------------------------- */

.site-header {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  /* min-height, not height: a tall logo lockup must not get clipped. */
  min-height: var(--header-height);
  padding: var(--logo-top-offset) var(--page-gutter) 0;
}

/*
 * A black-to-clear fade so the logo reads against a bright frame of the
 * showreel. It hangs off the header rather than the hero because it has to end
 * a fixed distance below the logo, and the header is the one box whose height
 * already follows the logo's. The negative z-index tucks it under the logo but
 * inside the header's stacking context, so it still paints over the video.
 */
.site-header::before {
  content: "";
  position: absolute;
  z-index: -1;
  /* The header's box ends at the bottom of the logo; this overshoots it. */
  inset: 0 0 calc(-1 * var(--logo-scrim-extent)) 0;
  background-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, var(--logo-scrim-opacity)),
    rgba(0, 0, 0, 0)
  );
  pointer-events: none;
}

.site-header__logo {
  display: inline-flex;
  color: inherit;
}

.site-header__logo img {
  width: var(--logo-width);
  /* The floor: below this the wordmark stops being readable. */
  min-width: var(--logo-min-width);
  max-width: var(--logo-max-width);
  height: auto;
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  height: 85vh; /* fallback for browsers without svh */
  height: var(--hero-height); /* svh ignores mobile chrome: no jump on scroll */
  min-height: 30rem;
  background-color: var(--color-video-placeholder);
}

.hero__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --------------------------------------------------------------------------
   Industries
   -------------------------------------------------------------------------- */

.industries {
  padding-top: clamp(3rem, 10vw, 7rem);
}

.industries__title {
  /*
   * The title keeps the page gutter and content width; the grid below it
   * deliberately does not, so it runs edge to edge.
   */
  max-width: var(--content-max);
  margin: 0 auto clamp(3rem, 8vw, 6rem);
  padding-inline: var(--page-gutter);
  text-align: center;
  font-size: 2.5rem;
  /* Georgia ships 400 and 700 only; 600 would have resolved to 700 anyway. */
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  /*
   * pretty, not balance: balance evens the line lengths out, which held the
   * headline to ~59% of the available width. pretty fills each line greedily
   * and only pulls words down to avoid a stranded last line. Browsers without
   * it fall back to normal wrapping, which is wider still.
   */
  text-wrap: pretty;
}

/* Positions the wordmark over the grid. */
.industries__strip {
  position: relative;
}

/*
 * One column on phones, two on tablets, four on desktop. No gap and no
 * rounding: the clips tile the full width of the page as a single strip.
 */
.industries__grid {
  display: grid;
  grid-template-columns: 1fr;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 40em) {
  .industries__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 64em) {
  .industries__grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.industries__link {
  position: relative;
  display: block;
  color: inherit;
  text-decoration: none;
}

/* The outline has to sit inside the tile: the grid has no gap to draw it in. */
.industries__link:focus-visible {
  outline-offset: -4px;
}

.industries__video {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  background-color: var(--color-video-placeholder);
}

/*
 * The black wash. On by default over both the clip and its label, so the strip
 * reads as one muted band; it lifts off the tile under the pointer or keyboard
 * focus to reveal the clip and label at full brightness.
 */
.industries__link::after {
  content: "";
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, var(--industry-overlay-opacity));
  transition: opacity var(--industry-overlay-duration) ease;
  pointer-events: none;
}

.industries__link:hover::after,
.industries__link:focus-visible::after {
  opacity: 0;
}

/*
 * Always visible, centred horizontally, sitting just above the bottom edge.
 * No z-index on desktop on purpose: the ::after wash is a later sibling, so
 * it paints over the label as well as the clip, and both brighten together on
 * hover. Phones and tablets override that below.
 */
.industries__label {
  position: absolute;
  inset: auto 0 var(--industry-label-offset);
  padding-inline: var(--page-gutter);
  text-align: center;
  font-size: var(--industry-label-size);
  /*
   * The lightest Georgia has: it ships regular and bold only, so anything
   * thinner than this means loading a webfont.
   */
  font-weight: 400;
  letter-spacing: 0.04em;
  pointer-events: none;
}

/*
 * Phones and tablets (the one- and two-column layouts): there is no hover to
 * lift the wash, so the label and its "see more" hint sit above it (z-index
 * over the ::after wash, which has none) and stay at full brightness. The
 * hint is the only cue that the tile is a link.
 */
.industries__more {
  display: block;
  margin-top: 0.5em;
  font-size: var(--industry-more-size);
  letter-spacing: 0.02em;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

@media (max-width: 63.99em) {
  .industries__label {
    z-index: 1;
  }
}

/* Desktop has hover, so the wash does the reveal and the hint goes. */
@media (min-width: 64em) {
  .industries__more {
    display: none;
  }
}

/*
 * The wordmark over the strip. Centred on the clips in the four-column layout;
 * in the one- and two-column layouts it sits near the top of the first row
 * instead, so it is on screen when the strip scrolls into view and clear of
 * the labels. Above the wash (which has no z-index of its own), and
 * click-through.
 */
.industries__wordmark {
  position: absolute;
  z-index: 1;
  top: var(--industry-wordmark-top);
  left: 50%;
  width: var(--industry-wordmark-width);
  height: auto;
  transform: translateX(-50%);
  pointer-events: none;
}

@media (min-width: 64em) {
  .industries__wordmark {
    top: 50%;
    transform: translate(-50%, -50%);
  }
}

/* --------------------------------------------------------------------------
   Subpages — hotels/, wineries/, realestate/, lifestyle/
   Logo, the industry's showreel, then the title. The header is absolutely
   positioned so it can overlay the hero on the home page; here nothing sits
   under it, so it goes back into the flow and the video simply follows it.
   -------------------------------------------------------------------------- */

.subpage .site-header {
  position: relative;
  inset: auto;
}

/* No video behind the logo here, so no scrim. */
.subpage .site-header::before {
  display: none;
}

.subpage__main {
  padding: var(--subpage-gap) 0 clamp(3rem, 10vw, 7rem);
}

/* Edge to edge on phones; from tablet up it keeps the page gutter. */
@media (min-width: 48em) {
  .subpage__showreel {
    padding-inline: var(--page-gutter);
  }
}

.subpage__video {
  /*
   * As wide as the page allows, up to the width that puts the clip at its
   * height cap. aspect-ratio sizes the box before the poster or metadata
   * arrive, so nothing below it jumps.
   */
  width: 100%;
  max-width: calc(85vh * var(--subpage-video-aspect)); /* browsers without svh */
  max-width: calc(var(--subpage-video-max-height) * var(--subpage-video-aspect));
  /* auto, or the markup's height attribute wins and the box is 1920px tall. */
  height: auto;
  aspect-ratio: var(--subpage-video-aspect);
  margin-inline: auto;
  background-color: var(--color-video-placeholder);
}

.subpage__title {
  max-width: var(--content-max);
  margin: var(--subpage-gap) auto 0;
  padding-inline: var(--page-gutter);
  text-align: center;
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* --------------------------------------------------------------------------
   Motion
   -------------------------------------------------------------------------- */

/* Hidden in the markup until motion.js reveals it, so it is never a dead control. */
.motion-toggle {
  position: fixed;
  right: var(--page-gutter);
  bottom: var(--page-gutter);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background-color: rgba(0, 0, 0, 0.65);
  color: var(--color-fg);
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
}

.motion-toggle:hover {
  background-color: rgba(0, 0, 0, 0.85);
}

.motion-toggle__icon {
  display: block;
  width: 1.125rem;
  height: 1.125rem;
}

/* aria-pressed is the single source of truth for which icon shows. */
.motion-toggle[aria-pressed='false'] .motion-toggle__icon--play,
.motion-toggle[aria-pressed='true'] .motion-toggle__icon--pause {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
