/* Knotport home: design preview. Plain CSS, no build step. */

:root {
  --font-display: "Newsreader", Georgia, serif;
  --font-sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-brand: "Marcellus", Georgia, serif;

  --gutter: clamp(16px, 4vw, 48px);
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  --rise: cubic-bezier(0.16, 0.84, 0.24, 1);

  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Base */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* No rubber-band past either end of the page: it would pull the scenes
     away and show a bare strip below the footer. Where a browser still
     bounces, the backdrop is night above and dark sand below. */
  overscroll-behavior-y: none;
  background: #2b2421 linear-gradient(#000, #000) top / 100% 50% no-repeat;
}

body {
  margin: 0;
  overflow-x: clip;
  background: #000;
  color: #fff;
  font-family: var(--font-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
p {
  margin: 0;
  font-weight: 400;
}

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

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Header: the wordmark, centred, over every scene */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 4.25rem;
  padding: 0.75rem var(--gutter);
  pointer-events: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  pointer-events: auto;
}

.brand__name {
  margin-right: -0.3em;
  font-family: var(--font-brand);
  font-size: clamp(0.875rem, 0.7rem + 0.35vw, 1.25rem);
  line-height: 1;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

/* The scenes behind the page */

.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #000;
}

.stage__sky {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.stage__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  will-change: opacity, transform;
}

.stage__video--sky {
  opacity: 1;
}

.stage__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.28) 38%, rgba(0, 0, 0, 0.3) 70%, rgba(0, 0, 0, 0.5) 100%);
}

.stage__grain {
  position: absolute;
  inset: 0;
  background-image: var(--grain);
  background-size: 180px;
  opacity: 0.06;
  mix-blend-mode: soft-light;
}

main,
.site-footer {
  position: relative;
  z-index: 1;
}

/* Heading, in the dark */

.hero {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100svh;
  padding: 0 var(--gutter) 6vh;
  text-align: center;
}

.hero__title {
  /* Wide enough for the longest line at any size, so it stays on two lines */
  max-width: min(14em, 100%);
  font-family: var(--font-display);
  font-weight: 300;
  font-optical-sizing: auto;
  font-size: clamp(2.625rem, 1.2rem + 5.8vw, 6.5625rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  text-wrap: balance;
  animation: rise-in 1.4s var(--ease) 0.2s both;
}

.hero__line {
  display: block;
}

/* The verb rolls through store, connect and trade */
.roll {
  position: relative;
  display: inline-block;
  height: 1.12em;
  margin: -0.05em 0;
  overflow: hidden;
  vertical-align: bottom;
  white-space: nowrap;
  transition: width 0.7s var(--ease);
}

.roll__word {
  position: absolute;
  left: 50%;
  top: 0;
  line-height: 1.12em;
  opacity: 0;
  transform: translate(-50%, 100%);
  transition: transform 0.8s var(--ease), opacity 0.8s var(--ease);
}

.roll__word.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.roll__word.is-out {
  opacity: 0;
  transform: translate(-50%, -100%);
}

.roll--still {
  height: auto;
  margin: 0;
  overflow: visible;
  white-space: normal;
}

/* Scroll room for the beach and the desert */

.pass {
  height: 140vh;
  height: 140svh;
}

/* Timneh, up out of the water */

.rise {
  height: 200vh;
  height: 200svh;
}

.rise__frame {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100svh;
  padding: 8vh var(--gutter) 0;
  text-align: center;
}

.rise__drops {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* The water box is two lines tall; its middle is the surface. The word above
   the surface is sharp; below it, the same word shows bent and dim, with a
   faint reflection. main.js moves all three together. */
.rise__water {
  position: relative;
  width: max-content;
  height: 2em;
  margin-bottom: -0.45em;
  font-size: clamp(4.5rem, 2rem + 11vw, 11.25rem);
}

.rise__above,
.rise__below {
  position: absolute;
  left: -0.15em;
  right: -0.15em;
  height: 1em;
  overflow: hidden;
}

.rise__above {
  top: 0;
}

.rise__below {
  top: 1em;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.55) 35%, transparent 90%);
  mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.55) 35%, transparent 90%);
}

.rise__title {
  display: block;
  padding: 0 0.15em;
  font-family: var(--font-display);
  font-weight: 300;
  font-optical-sizing: auto;
  font-size: 1em;
  line-height: 1;
  letter-spacing: -0.03em;
  white-space: nowrap;
  color: #eef4fb;
  text-shadow: 0 12px 48px rgba(4, 14, 34, 0.5);
  transform: translateY(1.4em);
  will-change: transform;
}

/* Invisible copy that gives the water box the width of the word */
.rise__title.rise__size {
  height: 0;
  padding: 0;
  overflow: hidden;
  visibility: hidden;
  transform: none;
}

.rise__title--under,
.rise__title--mirror {
  position: absolute;
  left: 0;
  text-shadow: none;
  filter: url(#underwater);
}

.rise__title--under {
  top: -1em;
  color: #a9c1df;
  opacity: 0;
}

.rise__title--mirror {
  top: 0;
  color: #c4d5ea;
  opacity: 0.2;
  transform: translateY(-1.4em) scaleY(-1);
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.rise__sub {
  margin-top: 0.9em;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(1.125rem, 0.8rem + 0.9vw, 1.75rem);
  line-height: 1.3;
  letter-spacing: 0.04em;
  text-wrap: balance;
  opacity: 0;
  transform: translateY(8px);
}

.rise.is-up .rise__sub {
  opacity: 1;
  transform: none;
  transition: opacity 1.2s ease 2s, transform 1.2s var(--ease) 2s;
}

/* KNOTPORT in sand, at the end of the desert */

/* The word's frame sits at the end of a tall section and sticks to the
   bottom of the window, so the whole rise happens in view while the reader
   scrolls through the section. */
.finale {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 140vh;
  height: 140svh;
}

.finale__frame {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 50vh;
  height: 50svh;
  padding: 0 var(--gutter);
}

.finale__grains {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* The bottom edge of this box is the surface of the sand */
.finale__clip {
  position: relative;
  overflow: hidden;
  padding: 0.1em 0.2em 0;
  -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 70%, transparent 100%);
}

.finale__word {
  margin-right: -0.14em;
  font-family: var(--font-brand);
  /* A logotype rather than reading text: it spans most of the width at any
     screen size, so it is allowed a wider range than the reading text. */
  font-size: clamp(2.5rem, 12vw, 14rem);
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  /* Packed sand: fine grain, lit from above, a little of the real dune texture */
  color: transparent;
  background:
    var(--grain) 0 0 / 140px,
    url("assets/sand.jpg?v=20261128j") center / 260% auto,
    linear-gradient(180deg, #d8c4b4 0%, #bba493 40%, #9a8476 75%, #7e6a5f 100%);
  background-blend-mode: overlay, soft-light, normal;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-stroke: 0.012em rgba(186, 164, 148, 0.75);
  opacity: 0.78;
  filter: url(#sandy) drop-shadow(0 -1px 0 rgba(236, 222, 208, 0.25)) drop-shadow(0 8px 12px rgba(30, 18, 10, 0.32)) drop-shadow(0 20px 32px rgba(20, 12, 6, 0.28));
  transform: translateY(110%);
  will-change: transform;
}

@media (max-width: 30em) {
  .finale__word {
    margin-right: -0.07em;
    letter-spacing: 0.07em;
  }
}

/* Footer, over the desert, in front of the sand letters */

.site-footer {
  z-index: 2;
  margin-top: -1.6em;
  padding: 1.75em var(--gutter) 2em;
  color: rgba(226, 208, 192, 0.62);
  font-size: clamp(0.75rem, 0.7rem + 0.15vw, 0.9375rem);
  text-align: center;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero__title {
    animation: none;
  }

  .roll,
  .roll__word {
    transition: none;
  }

  .rise__sub {
    opacity: 1;
    transform: none;
  }

  .finale__word {
    transform: none;
  }
}
