/* Google Sans, variable weight 400..700, copied from
   `@fontsource-variable/google-sans` (OFL-1.1) in the latin and latin-ext
   subsets, the two that English and Polish need. Same declarations as
   apps/hello/src/styles.css. */
@font-face {
  font-family: "Google Sans";
  src: url("/fonts/google-sans-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Google Sans";
  src: url("/fonts/google-sans-latin-ext-wght-normal.woff2") format("woff2-variations");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
    U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* The text always sits on the darkened picture, by day and by night, so the
   page has one palette: white on the scene. `--water` is the open water at
   the bottom of the frame, shown while the scene loads where there is no
   still of the frame (landscape windows). */
:root {
  --water: #2c6a93;
  --text-high: #ffffff;
  --text-med: rgb(255 255 255 / 0.82);
  --text-low: rgb(255 255 255 / 0.72);
  --glass: rgb(255 255 255 / 0.16);
  --glass-border: rgb(255 255 255 / 0.24);
  --gutter: 20px;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --water: #10263b;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--water);
  color: var(--text-high);
  font-family: "Google Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* The picture: the still of the scene's opening frame under the live scene,
   which is transparent until its first frame and then fades in over it. */
.stage {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.still,
.scene,
.scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* `color-scheme: normal` matches the scene document's own. A frame whose
   scheme differs from its document's gets an opaque white backdrop, which
   would cover the still until the scene's first frame. */
.scene {
  border: 0;
  background: transparent;
  color-scheme: normal;
}

/* The stills are the mobile app's, captured at 393 by 852, so they only
   stand in for the portrait frame. */
@media (orientation: portrait) {
  .still {
    background: url("/stills/welcome-day.jpg") center / cover no-repeat;
  }
}

@media (orientation: portrait) and (prefers-color-scheme: dark) {
  .still {
    background-image: url("/stills/welcome-night.jpg");
  }
}

/* The mobile welcome screen's scrim: dark behind the wordmark, clear over the
   boats, darkest behind the text. */
.scrim {
  background: linear-gradient(
    to bottom,
    rgb(0 0 0 / 0.45) 0%,
    rgb(0 0 0 / 0) 22%,
    rgb(0 0 0 / 0) 40%,
    rgb(0 0 0 / 0.55) 70%,
    rgb(0 0 0 / 0.85) 100%
  );
}

.top {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: calc(env(safe-area-inset-top) + 20px) var(--gutter) 0;
}

.wordmark {
  display: block;
  height: 32px;
  width: auto;
}

.language {
  position: absolute;
  right: var(--gutter);
  top: calc(env(safe-area-inset-top) + 16px);
  min-width: 44px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  color: var(--text-high);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.language:hover {
  background: rgb(255 255 255 / 0.24);
}

.language:focus-visible,
.contact a:focus-visible {
  outline: 2px solid var(--text-high);
  outline-offset: 3px;
}

.copy {
  position: relative;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 36rem;
  padding: 0 var(--gutter) calc(env(safe-area-inset-bottom) + 28px);
  /* Hidden until `page.js` has chosen the language, so a Polish reader never
     sees the English text first. */
  opacity: 0;
  transition: opacity 300ms ease-out;
}

.ready .copy {
  opacity: 1;
}

.copy p,
.copy h1 {
  margin: 0;
}

.eyebrow {
  align-self: flex-start;
  margin-bottom: 4px !important;
  padding: 6px 12px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.headline {
  font-size: 30px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.note {
  color: var(--text-med);
  font-size: 16px;
  line-height: 1.5;
  text-wrap: pretty;
}

.contact {
  padding-top: 8px;
  color: var(--text-low);
  font-size: 14px;
  line-height: 1.5;
}

.contact a {
  color: var(--text-high);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  border-radius: 4px;
}

/* A landscape window: the harbour fills the right of the frame and the text
   sits over open water at the bottom left (`WIDE_SHOT` in the scene). A phone
   held sideways is too short for this type and keeps the phone's. */
@media (orientation: landscape) and (min-width: 768px) and (min-height: 560px) {
  :root {
    --gutter: 48px;
  }

  .scrim {
    background:
      linear-gradient(to bottom, rgb(0 0 0 / 0.4) 0%, rgb(0 0 0 / 0) 22%),
      radial-gradient(
        ellipse 70% 75% at 0% 100%,
        rgb(0 0 0 / 0.78) 0%,
        rgb(0 0 0 / 0.45) 45%,
        rgb(0 0 0 / 0) 100%
      );
  }

  .top {
    justify-content: flex-start;
    padding-top: calc(env(safe-area-inset-top) + 36px);
  }

  .language {
    top: calc(env(safe-area-inset-top) + 32px);
  }

  .copy {
    gap: 14px;
    padding-bottom: 56px;
  }

  .headline {
    font-size: 48px;
    line-height: 1.08;
  }

  .note {
    font-size: 18px;
  }

  .contact {
    font-size: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .copy {
    transition: none;
  }
}
