@font-face {
  font-family: "ES Build";
  src: url("Typography%20MatrixBio/ES%20Build.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "ES Build";
  src: url("Typography%20MatrixBio/ES%20Build%20Medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --black: #1A1A1A;
  --red: #FA5B47;
  --yellow: #F1B355;
  --lilac: #E4B9FD;
  --white: #FCFCFC;

  --font-display: "ES Build", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --mx: 0;
  --my: 0;

  /* every size is a rem multiple of the single root font-size below,
     so all elements scale together and keep their ratios at any width */
  --edge: 2.5rem;
  --title-size: 18rem;
  --logo-size: 6.4rem;
  --body-text-size: 1.1rem;
  --icon-size: 1.45rem;
  --social-gap: 0.85rem;
  --link-gap: 0.45rem;

  --brand-gradient: linear-gradient(
    100deg,
    var(--red) 0%,
    var(--yellow) 55%,
    var(--lilac) 100%
  );
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  /* the single proportional knob: scale up/down with the viewport,
     clamped only at the extremes. min() guards short landscape so the
     title can't overflow vertically. */
  font-size: clamp(12px, min(1.3vw, 3vh), 26px);
  /* gradient fallback so any 1px sliver on iOS stays on-brand, not black/white */
  background: var(--brand-gradient);
  overscroll-behavior: none;
}

body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  position: fixed;
  inset: 0;
  font-family: var(--font-body);
  color: var(--black);
  background: transparent;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  width: 100vw;
  height: 100vh;     /* fallback */
  height: 100dvh;    /* visible area drives content layout */
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding-top: max(var(--edge), env(safe-area-inset-top));
  padding-right: max(var(--edge), env(safe-area-inset-right));
  padding-bottom: max(var(--edge), env(safe-area-inset-bottom));
  padding-left: max(var(--edge), env(safe-area-inset-left));
}

/* full-bleed gradient that always covers, even when iOS toolbars retract */
.stage::before {
  content: "";
  position: fixed;
  top: -2px;
  left: -2px;
  width: calc(100vw + 4px);
  height: calc(100vh + 4px);    /* fallback */
  height: calc(100lvh + 4px);   /* tallest viewport state, so no gap at the bottom */
  z-index: 0;
  background: linear-gradient(
    calc(100deg + var(--mx) * 70deg + var(--my) * 25deg),
    var(--red) 0%,
    var(--yellow) 55%,
    var(--lilac) 100%
  );
  will-change: background;
}

.logo,
.title,
.corner-links {
  position: relative;
  z-index: 1;
}

.logo {
  position: absolute;
  top: max(var(--edge), env(safe-area-inset-top));
  left: max(var(--edge), env(safe-area-inset-left));
  width: var(--logo-size);
  height: auto;
  transform: rotate(calc(var(--mx) * 6deg));
  transform-origin: center;
  will-change: transform;
}

.title {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--white);
  font-size: var(--title-size);
  line-height: 0.92;
  letter-spacing: -0.03em;
  text-align: right;
  margin-top: 0;
  text-box: trim-start cap alphabetic;
}

.corner-links {
  position: absolute;
  left: max(var(--edge), env(safe-area-inset-left));
  bottom: max(var(--edge), env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: var(--link-gap);
}

.corner-links a {
  color: var(--white);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--body-text-size);
  width: fit-content;
  opacity: 0.92;
  transition: opacity 0.18s ease;
}

.corner-links a:hover {
  opacity: 0.6;
}

.tagline {
  color: var(--white);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--body-text-size);
  line-height: 1.2;
  margin-bottom: clamp(0.15rem, 0.3vw, 0.35rem);
}

.socials {
  display: flex;
  align-items: center;
  gap: var(--social-gap);
  margin-top: clamp(0.35rem, 0.8vw, 0.7rem);
}

.socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.socials svg {
  width: var(--icon-size);
  height: auto;
  fill: var(--white);
  display: block;
}

@supports (height: 100dvh) {
  .stage {
    height: 100dvh;
    min-height: 100dvh;
  }
}

/* below 800px, step out of the proportional system and tune for mobile.
   one breakpoint instead of three, so nothing recomposes as you resize. */
@media (max-width: 800px) {
  html {
    font-size: 16px;
  }

  :root {
    --edge: clamp(1rem, 5vw, 1.75rem);
    --title-size: clamp(3.75rem, 24vw, 8rem);
    --logo-size: calc(var(--title-size) * 0.7);
    --body-text-size: clamp(0.95rem, 3.7vw, 1.15rem);
    --icon-size: clamp(1.25rem, 5vw, 1.6rem);
    --social-gap: clamp(0.6rem, 3vw, 0.9rem);
    --link-gap: clamp(0.25rem, 1vw, 0.5rem);
  }
}

/* short landscape safeguard so the title fits vertically */
@media (orientation: landscape) and (max-height: 480px) {
  :root {
    --title-size: clamp(2.75rem, 22vh, 7rem);
    --logo-size: calc(var(--title-size) * 0.7);
  }
}

@media (prefers-reduced-motion: reduce) {
  .stage::before {
    background: var(--brand-gradient);
  }

  .logo {
    transform: none;
  }
}
