@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Outfit";
  src: url("/fonts/outfit-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --paper: #eaf0ee;
  --paper-deep: #d9eae2;
  --ink: #182523;
  --muted: #566763;
  --line: #c7d6d0;
  --forest: #18735b;
  --mint: #81ddbb;
  --night: #12201d;
  --night-soft: #a9bab5;

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;

  --gutter: clamp(1.25rem, 5vw, 3.5rem);
  --measure: 1120px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 1.5rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--forest);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 8px;
  transition: top 0.15s;
}
.skip:focus {
  top: 1rem;
}

.wrap {
  width: min(100% - var(--gutter) * 2, var(--measure));
  margin-inline: auto;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 650;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.offscreen {
  position: fixed;
  left: 0;
  top: 0;
  z-index: -1;
  width: 2px;
  height: 2px;
  opacity: 0.01;
  pointer-events: none;
}

/* The 3D layer. It only exists when WebGL starts; otherwise the 2D art stays. */

/* Two WebGL layers. Tofi has a small fixed canvas that follows you around; the phone
   has its own canvas inside the pinned column, so it scrolls natively with the page. */

.tofi-gl {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 8;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s;
  will-change: transform;
}
.phone-gl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s;
}
.gl .tofi-gl,
.gl .phone-gl {
  opacity: 1;
}
.slot {
  position: absolute;
  pointer-events: none;
  visibility: hidden;
}
.gl .tofi-2d,
.gl .phone-fallback {
  visibility: hidden;
}

.bubble {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 9;
  width: max-content;
  max-width: min(15rem, calc(100vw - 2rem));
  margin: 0;
  padding: 0.7rem 1rem;
  background: #fff;
  color: var(--ink);
  border-radius: 1.1rem;
  font-size: 0.975rem;
  line-height: 1.4;
  box-shadow: 0 10px 28px -10px rgba(24, 37, 35, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.bubble.show {
  opacity: 1;
}
.bubble::after {
  content: "";
  position: absolute;
  bottom: -6px;
  width: 14px;
  height: 14px;
  background: #fff;
  transform: rotate(45deg);
  border-radius: 2px;
}
.bubble.tail-right::after {
  right: 1.1rem;
}
.bubble.tail-left::after {
  left: 1.1rem;
}

.tofi-hit {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 10;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Header */

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  width: min(100% - var(--gutter) * 2, var(--measure));
  margin-inline: auto;
  padding-block: 1.5rem;
  position: relative;
  z-index: 2;
}
.wordmark {
  font-family: var(--serif);
  font-weight: 650;
  font-size: 1.2rem;
  text-decoration: none;
}
.top nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  font-size: 0.975rem;
}
.top nav a {
  text-decoration: none;
  color: var(--muted);
  padding-block: 0.15rem;
  border-bottom: 2px solid transparent;
}
.top nav a:hover {
  color: var(--ink);
  border-bottom-color: var(--forest);
}

/* Buttons */

.btn {
  display: inline-block;
  padding: 0.8rem 1.4rem;
  border-radius: 999px;
  font-weight: 500;
  text-decoration: none;
  line-height: 1.2;
  border: 2px solid transparent;
  background: none;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.btn-solid {
  background: var(--ink);
  color: var(--paper);
}
.btn-solid:hover {
  background: var(--forest);
}
.btn-quiet {
  border-color: var(--line);
}
.btn-quiet:hover {
  border-color: var(--ink);
}
.btn-mint {
  background: var(--mint);
  color: var(--night);
}
.btn-mint:hover {
  background: #fff;
}
.btn-ghost {
  border-color: rgba(234, 240, 238, 0.35);
  color: var(--paper);
}
.btn-ghost:hover {
  border-color: var(--mint);
  color: var(--mint);
}
.tl :focus-visible,
.contact :focus-visible,
.film :focus-visible {
  outline-color: var(--mint);
}

/* Hero */

.hero {
  width: min(100% - var(--gutter) * 2, var(--measure));
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  align-items: center;
  gap: clamp(1rem, 4vw, 4rem);
  padding-block: clamp(2rem, 6vw, 5rem) clamp(4rem, 9vw, 8rem);
}

.hero h1 {
  font-size: clamp(2.4rem, 5.4vw, 4.9rem);
  line-height: 1.03;
  letter-spacing: -0.028em;
  font-weight: 700;
  max-width: 13ch;
}

.lede {
  margin-top: 1.75rem;
  max-width: 34rem;
  font-size: clamp(1.1rem, 1.5vw, 1.3rem);
  line-height: 1.55;
  color: var(--muted);
}

.hero-links {
  margin-top: 2.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tofi-stage {
  position: relative;
  justify-self: center;
  width: min(100%, 26rem);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}
.tofi-stage::before {
  content: "";
  position: absolute;
  inset: 4% 0 0;
  border-radius: 50%;
  background: var(--paper-deep);
}
.tofi-stage .tofi-2d {
  position: relative;
  width: 92%;
}
.slot-hero {
  inset: 4% 0 0;
}

/* TofuLove */

.tl {
  position: relative;
  /* The rings are a background layer rather than an oversized pseudo-element, so nothing
     overflows and the section needs no clipping. WebKit repositions sticky elements inside
     clipped ancestors on the main thread, which makes the pinned phone jump on iOS. */
  background:
    repeating-radial-gradient(
        circle,
        transparent 0 5.6vmax,
        rgba(129, 221, 187, 0.09) 5.6vmax calc(5.6vmax + 1px)
      )
      right -20vmax top -26vmax / 80vmax 80vmax no-repeat,
    var(--night);
  color: var(--paper);
  padding-block: clamp(4rem, 9vw, 8rem) clamp(3rem, 6vw, 5rem);
}
.tl .wrap {
  position: relative;
}

.tl-head h2 {
  font-size: clamp(3.6rem, 13vw, 10.5rem);
  line-height: 0.95;
  letter-spacing: -0.035em;
  font-weight: 750;
}
.tl-tag {
  margin-top: 0.5rem;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.6rem, 3.6vw, 2.8rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--mint);
}

.stage {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 2rem clamp(1.5rem, 4vw, 4rem);
}
.step {
  min-height: 48svh;
  transition: opacity 0.4s;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: 2rem;
}
.step:first-child {
  min-height: 70svh;
  justify-content: flex-start;
  padding-top: 0;
}
.step h3 {
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  line-height: 1.1;
  font-weight: 650;
}
.step h3 + p {
  margin-top: 0.75rem;
  max-width: 26rem;
  color: var(--night-soft);
  font-size: 1.1rem;
}
.tl-lede {
  font-size: clamp(1.15rem, 1.7vw, 1.4rem);
  line-height: 1.5;
}
.tl-status {
  margin-top: 1.25rem;
  color: var(--night-soft);
}
.tl-actions {
  margin-top: 1.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.stage-visual {
  position: sticky;
  top: 0;
  height: 100svh;
  align-self: start;
}
.slot-phone {
  left: 44%;
  top: 50%;
  height: min(80%, 800px);
  aspect-ratio: 152 / 316;
  transform: translate(-50%, -50%);
}
.slot-tofi {
  right: -2%;
  bottom: 6%;
  width: clamp(110px, 12vw, 170px);
  aspect-ratio: 1;
}

.phone-fallback {
  display: none;
  position: absolute;
  inset: 0;
  margin: auto;
  height: min(80%, 800px);
  aspect-ratio: 152 / 316;
  padding: 0.5rem;
  border: 0;
  border-radius: 2.6rem;
  background: #dfe4e0;
  cursor: pointer;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.7);
}
.phone-fallback img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2.1rem;
}
html:not(.gl) .phone-fallback {
  display: block;
}

.built {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  max-width: 44rem;
  color: var(--night-soft);
  font-size: 0.975rem;
}

/* Film dialog */

.film {
  width: min(94vw, 1100px);
  max-height: 94vh;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: #0b1513;
  color: var(--paper);
  overflow: hidden;
}
.film::backdrop {
  background: rgba(8, 14, 12, 0.82);
}
.film video {
  width: 100%;
  max-height: calc(94vh - 3.5rem);
  background: #000;
}
.film form {
  display: flex;
  justify-content: flex-end;
  padding: 0.5rem 0.75rem;
}
.film-close {
  padding: 0.4rem 0.9rem;
  border: 1px solid rgba(234, 240, 238, 0.35);
  border-radius: 999px;
  background: none;
  cursor: pointer;
}
.film-close:hover {
  border-color: var(--mint);
  color: var(--mint);
}
@media (orientation: portrait) {
  .film {
    width: min(94vw, 460px);
  }
}

/* About */

.about {
  position: relative;
  padding-block: clamp(4rem, 8vw, 7rem) 0;
}
.about h2,
.contact h2 {
  font-size: clamp(2.2rem, 4.5vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  font-weight: 700;
}
.about p {
  margin-top: 1rem;
  max-width: 38rem;
  color: var(--muted);
}
.about h2 + p {
  margin-top: clamp(1.5rem, 3vw, 2rem);
}

/* Contact */

.contact {
  margin-top: clamp(4rem, 8vw, 7rem);
  background: var(--forest);
  color: #fff;
  padding-top: clamp(3.5rem, 7vw, 6rem);
  overflow: hidden;
}
.contact-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 2rem;
}
.contact-inner > div:first-child {
  padding-bottom: clamp(3.5rem, 7vw, 6rem);
}
.contact h2 {
  color: #fff;
}
.contact-lede {
  margin-top: 0.75rem;
  max-width: 30rem;
  color: rgba(255, 255, 255, 0.86);
}
.mail {
  display: inline-block;
  margin-top: 1.75rem;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.4rem, 4vw, 2.9rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
}
.mail:hover {
  color: var(--mint);
}
.elsewhere {
  margin-top: 1.5rem;
  display: flex;
  gap: 1.75rem;
  font-weight: 500;
}
.elsewhere a {
  text-underline-offset: 0.2em;
}
.elsewhere a:hover {
  color: var(--mint);
}

.contact-tofi {
  position: relative;
  width: clamp(11rem, 22vw, 16rem);
  aspect-ratio: 1;
}
.contact-tofi .tofi-2d {
  position: absolute;
  inset: auto 0 -0.5rem;
}
.slot-contact {
  inset: 0;
}

/* 404 */

.lost {
  padding-block: 18vh 12vh;
}
.lost h1 {
  font-size: clamp(2.5rem, 7vw, 5rem);
  line-height: 1.05;
}

/* Footer */

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-block: 1.75rem 2.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.gl .step {
  opacity: 0.3;
  transition: opacity 0.35s;
}
.gl .step.is-active {
  opacity: 1;
}

/* Without the 3D layer the steps are plain text blocks */

html:not(.gl) .step,
html:not(.gl) .step:first-child {
  min-height: 0;
  padding-block: 1.25rem;
}
html:not(.gl) .stage-visual {
  position: relative;
  height: min(80svh, 720px);
}

/* Smaller screens */

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .hero h1 {
    max-width: 14ch;
  }
  .hero {
    padding-bottom: 3rem;
  }
  .tofi-stage {
    width: min(64%, 15rem);
    justify-self: end;
    margin-top: 0;
  }

  .stage {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .stage-text {
    display: contents;
  }
  .stage-visual {
    order: -1;
    z-index: 3;
    height: 58svh;
    background: var(--night);
  }
  .slot-phone {
    left: 60%;
    height: 90%;
  }
  .slot-tofi {
    right: auto;
    left: 0;
    bottom: 3%;
    width: min(24vw, 110px);
  }
  .step {
    min-height: 40svh;
    justify-content: center;
    padding-block: 1.5rem;
  }
  .step:first-child {
    order: -2;
    min-height: 0;
    justify-content: flex-start;
    padding-bottom: 2.5rem;
  }
  .gl .step:first-child {
    opacity: 1;
  }
  html:not(.gl) .stage-visual {
    height: min(62svh, 560px);
  }
}

@media (max-width: 600px) {
  body {
    font-size: 1rem;
  }
  .bubble {
    max-width: 12.5rem;
    padding: 0.55rem 0.8rem;
    font-size: 0.875rem;
  }
  .contact-inner {
    grid-template-columns: 1fr;
  }
  .contact-tofi {
    justify-self: end;
    width: 9rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .btn {
    transition: none;
  }
}
