* {
  box-sizing: border-box;
}

:root {
  color-scheme: light dark;
  --primary-color: #ff7900;
  --muted-primary-color: #d96500;
  --background-color: #f7f7f5;
  --text-color: #171717;
  --muted-text-color: #555;
  --header-background: rgba(247, 247, 245, 0.5);
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary-color: #ff7900;
    --muted-primary-color: #d96500;
    --background-color: #171717;
    --text-color: #f7f7f5;
    --muted-text-color: #aaa;
    --header-background: rgba(23, 23, 23, 0.5);
  }
}

/* The body is a full-height column so the footer can be pushed to the bottom of a
   short page; a page whose content is taller than the viewport simply scrolls and
   the footer waits below the fold. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh; /* ignores mobile browser chrome, so 100vh never forces a stray scroll */
  margin: 0;
  padding-top: 6rem;
  background: var(--background-color);
  color: var(--text-color);
  font-family: Helvetica, Arial, sans-serif;
}

header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;

  background: var(--header-background);
  backdrop-filter: blur(10px);
}

header > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem clamp(2rem, 6vw, 6rem);
}

.nav-link {
  color: var(--text-color);
  text-decoration: none;
  margin-right: 3rem;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: var(--muted-text-color);
}

.nav-link.active {
  font-weight: bold;
}

.sign-up-button {
  background: var(--primary-color);
  border-radius: 0.8rem;
  color: #fff;
  font-weight: bold;
  padding: 0.75rem 1.25rem;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.sign-up-button:hover {
  background: var(--muted-primary-color);
}

.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem clamp(2rem, 6vw, 6rem);
}

.content-section {
  max-width: 1280px;
  margin: 0 auto;
  padding: 4rem clamp(2rem, 6vw, 6rem);
}

footer {
  margin-top: auto;
  padding: 0 1rem;
}

footer p {
  text-align: right;
  font-size: 0.9rem;
  color: var(--muted-text-color);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 2rem;
}

.footer-links a {
  color: var(--muted-text-color);
  font-size: 0.95rem;
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

i {
  font-family: "Instrument Serif";
}

h1 {
  font-size: 3.5rem;
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.055em;
}

h1 i {
  color: var(--primary-color);
}

h2 {
  font-size: 1.75rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

p,
li {
  color: var(--muted-text-color);
  font-size: 1.25rem;
  line-height: 1.5;
}

/* The art is a fixed 28rem x 28rem composition: the iframes have to keep their real
   device viewports (390x844 and 1024x768) so the demo pages lay out normally, and they
   are scaled down inside it. So `.hero-devices` is a square slot that shrinks with the
   hero, and `.hero-stage` holds the composition and is scaled as one unit. Scaling the
   stage (rather than the iframes one by one) is what keeps its layout footprint from
   making the page wider than the screen. */
.hero-devices {
  position: relative;
  width: 100%;
  max-width: 28rem;
  min-width: 0; /* let the 1fr grid track shrink below the stage's 28rem */
  aspect-ratio: 1;
  margin-inline: auto;
  container-type: inline-size; /* makes 100cqw the slot's own width */
}

.hero-image {
  width: 28rem;
  max-width: 100%;
  margin-inline: auto;
}

.hero-stage {
  position: absolute; /* out of flow, so its 28rem height adds no layout height */
  top: 0;
  left: 0;
  width: 28rem;
  height: 28rem;
  transform-origin: top left;
  /* Slot width / design width as a plain number: atan2 turns the two lengths into the
     angle of the slope, tan turns that angle back into the ratio itself. */
  transform: scale(min(1, tan(atan2(100cqw, 28rem))));
}

.hero-phone,
.hero-tablet {
  position: absolute;
  border: none;
  background: transparent;
  transform-origin: bottom left;
  pointer-events: none; /* decorative: a swipe over the art scrolls the page, not the demo */
}

.hero-phone {
  bottom: 1rem;
  left: 0;
  width: 390px;
  height: 844px;
  transform: scale(0.4777);
}

.hero-tablet {
  bottom: 0;
  left: 2rem;
  width: 1024px;
  height: 768px;
  transform: scale(0.3802);
}

.content-iframe {
  position: fixed;
  width: 100%;
  height: 100%;
  border: none;
}

.contact-item {
  padding: 1rem 0;
}

.contact-item a {
  color: var(--muted-text-color);
}

.contact-form {
  border: none;
  width: 100%;
  height: 580px;
}

.nav-toggle {
  display: none;
}

.nav-desktop {
  display: block;
}

.nav-mobile {
  display: none;
}

@media (max-width: 800px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .nav-toggle {
    background: none;
    border: none;
    display: inline-block;
  }

  .nav-toggle:hover {
    cursor: pointer;
    color: var(--muted-text-color);
  }

  .nav-desktop {
    display: none;
  }

  .nav-mobile {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 0;
  }

  /* The open state is a class, not an inline style, so it is scoped to the mobile
     media query: widening the window hides the mobile menu again. */
  .nav-mobile.nav-open {
    display: flex;
  }

  .nav-link,
  .sign-up-button {
    margin-inline: auto;
  }
}
