/* Twosday's landing page (A2): one screen on a laptop. The app's tokens:
   Theme.swift and Typography.swift. */

@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces.woff2") format("woff2");
  font-weight: 250 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-italic.woff2") format("woff2");
  font-weight: 250 500;
  font-style: italic;
  font-display: swap;
}

:root {
  color-scheme: dark;

  --bg-deep: #0e0c0e;
  --bg-base: #161316;
  --surface-button: #312a31;
  --surface-grid: #1b181b;
  --stroke: rgba(248, 216, 252, 0.12);
  --stroke-subtle: rgba(248, 216, 252, 0.06);

  --text: #eae0e6;
  --text-2: #d1c5ce;
  --text-3: #998d99;
  --text-subtle: #4e434d;

  --primary: #eca4fd;
  --secondary: #ffb2bc;

  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;

  --gutter: 16px;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-ios: cubic-bezier(0.32, 0.72, 0, 1);
}

@media (min-width: 720px) {
  :root { --gutter: 32px; }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg-deep);
}

html:has(dialog[open]) {
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
picture {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

h1,
h2,
p {
  margin: 0;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.wrap {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

.display {
  font-family: var(--font-display);
  font-weight: 280;
  font-variation-settings: "WONK" 0;
  font-optical-sizing: auto;
  letter-spacing: -0.015em;
  line-height: 1.12;
}

/* ── The page: on a laptop, the whole of it fits the window ───────────────── */

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding-top: 20px;
  padding-bottom: 28px;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  padding: 0 26px;
  border: 0;
  border-radius: 999px;
  font: 590 17px/1 var(--font-ui);
  letter-spacing: -0.02em;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.2s var(--ease-out), background-color 0.2s ease, opacity 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}

.btn-small {
  height: 40px;
  padding: 0 18px;
  font-size: 15px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--stroke);
}

.btn-small:hover {
  background: rgba(255, 255, 255, 0.09);
}

.btn-primary {
  background: #fbf7fa;
  color: var(--bg-deep);
}

.btn-primary:hover {
  background: #ffffff;
}

.btn-primary:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

/* The pink pill: a phone's Join the waitlist, under what Twosday is. */
.btn-accent {
  background: var(--primary);
  color: var(--bg-deep);
}

.btn-accent:hover {
  background: #f3c2fe;
}

/* ── Header ───────────────────────────────────────────────────────────────── */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  flex: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand img {
  width: 30px;
  height: 30px;
}

.brand span {
  font-family: var(--font-display);
  font-weight: 300;
  font-variation-settings: "WONK" 0;
  font-size: 24px;
  letter-spacing: -0.02em;
  line-height: 1;
}

/* ── The headline ─────────────────────────────────────────────────────────── */

/* The headline with what Twosday is under it, above the phones. */
.intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.headline {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 280;
  font-variation-settings: "WONK" 0;
  font-optical-sizing: auto;
  font-size: 38px;
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--text-2);
  text-align: center;
  text-wrap: balance;
}

@media (max-width: 400px) {
  .headline {
    font-size: 34px;
  }
}

/* ── The phones: Denton's screens, with James's data ─────────────────────── */

.stage {
  width: 100%;
}

.phones {
  --gap: 20px;
  display: flex;
  gap: var(--gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.phone {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Only a phone's carousel shows these (at the end of this file). */
.slide-about,
.dots {
  display: none;
}

.caption {
  margin-top: 14px;
  max-width: 100%;
  color: var(--text-2);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: -0.015em;
  text-align: center;
  text-wrap: balance;
}

.device {
  --w: 240px;
  --bezel: calc(var(--w) * 0.034);
  width: calc(var(--w) + 2 * var(--bezel));
}

.device-frame {
  padding: var(--bezel);
  border-radius: calc(var(--w) * 0.142 + var(--bezel));
  background: linear-gradient(160deg, #3b373a 0%, #19161a 22%, #0b0a0b 55%, #242024 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    inset 0 1px 1px rgba(255, 255, 255, 0.12),
    0 0 0 1px #050405;
}

.screen {
  position: relative;
  width: var(--w);
  aspect-ratio: 393 / 852;
  border-radius: calc(var(--w) * 0.142);
  overflow: hidden;
  background: var(--bg-deep);
  container-type: inline-size;
  isolation: isolate;
  transform: translateZ(0);
}

.layer {
  position: absolute;
  inset: 0;
  visibility: hidden;
}

.layer.is-on {
  visibility: visible;
}

.layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.island {
  position: absolute;
  z-index: 4;
  top: calc(100cqw * 11 / 393);
  left: 50%;
  width: calc(100cqw * 125 / 393);
  height: calc(100cqw * 37 / 393);
  border-radius: 999px;
  background: #000;
  transform: translateX(-50%);
  pointer-events: none;
}

.tap {
  position: absolute;
  z-index: 5;
  width: calc(100cqw * 46 / 393);
  height: calc(100cqw * 46 / 393);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.6), 0 0 18px rgba(255, 255, 255, 0.25);
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
}

/* On a phone and a narrow window, the row scrolls sideways. */
.phones {
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  margin: 0 calc(-1 * var(--gutter));
  padding: 4px var(--gutter) 8px;
}

.phones::-webkit-scrollbar {
  display: none;
}

.phone {
  scroll-snap-align: center;
}

.device {
  --w: min(240px, 58vw);
}

/* On a laptop, the five fit side by side and the phones take the height left:
   the row is a size container, so 100cqh is what's left of the window. */
@media (min-width: 900px) and (min-height: 540px) {
  .page {
    height: 100vh;
    height: 100dvh;
    min-height: 540px;
  }

  .main {
    min-height: 0;
    gap: clamp(18px, 3vh, 36px);
    padding-top: clamp(4px, 1.6vh, 24px);
    padding-bottom: clamp(12px, 2.4vh, 28px);
  }

  .stage {
    flex: 1;
    min-height: 0;
    container-type: size;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .phones {
    --gap: clamp(16px, 2.2vw, 36px);
    overflow: visible;
    margin: 0;
    padding: 0;
    justify-content: center;
  }

  /* Height: the stage less the caption (two lines at most). Width: a fifth
     of the row less the gaps. The phone's whole height is 2.236 × its screen's
     width (852 / 393 and the bezels). */
  .device {
    --w: min(250px, calc((100cqh - 56px) / 2.236), calc((100cqw - 4 * var(--gap)) / 5 / 1.068));
  }

  .caption {
    min-height: 2.6em;
  }
}

/* ── About ────────────────────────────────────────────────────────────────── */

.about {
  max-width: 52em;
  color: var(--text-3);
  font-size: 16px;
  line-height: 1.55;
  text-align: center;
  text-wrap: balance;
}

/* Opens the waitlist, like the header's button, in the description's words. */
.about-join {
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */

.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  padding-top: 18px;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--stroke-subtle);
  color: var(--text-3);
  font-size: 14px;
  flex: none;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-links a {
  color: var(--text-2);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--text);
}

/* On a phone the links are a menu behind the footer's ⋯ (the last block of
   this file). Everywhere else the popover is just this row of links. */
.footer-links[popover] {
  position: static;
  inset: auto;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: visible;
  background: none;
  color: inherit;
}

.footer-more {
  display: none;
}

.motion-toggle {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-3);
  font: inherit;
  cursor: pointer;
}

.motion-toggle:hover {
  color: var(--text-2);
}

.no-js .motion-item {
  display: none;
}

/* ── The waitlist sheet ───────────────────────────────────────────────────── */

.sheet {
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 30px;
  background: #1d171b;
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--stroke), 0 40px 120px rgba(0, 0, 0, 0.6);
  overflow: auto;
  overscroll-behavior: contain;
}

.sheet::backdrop {
  background: rgba(8, 6, 8, 0.62);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.sheet[open] {
  animation: sheet-in 0.36s var(--ease-ios);
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.sheet-inner {
  position: relative;
  padding: 30px 26px 28px;
}

.sheet-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface-button);
  color: var(--text-2);
  cursor: pointer;
}

.sheet-close svg {
  width: 12px;
  height: 12px;
}

.sheet h2 {
  margin: 0 48px 8px 0;
  font-size: 32px;
}

.sheet-lead {
  margin-bottom: 24px;
  color: var(--text-3);
  font-size: 16px;
  line-height: 1.5;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field label {
  color: var(--text-2);
  font-size: 14px;
  font-weight: 510;
}

.field input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--surface-button);
  color: var(--text);
  font: 400 17px/1.2 var(--font-ui);
  letter-spacing: -0.02em;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus {
  outline: none;
  border-color: rgba(236, 164, 253, 0.6);
  box-shadow: 0 0 0 4px rgba(236, 164, 253, 0.14);
}

.checks {
  display: grid;
  gap: 12px;
  margin: 6px 0 0;
}

.checks + .checks {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--stroke-subtle);
}

.check {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  align-items: start;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.4;
  cursor: pointer;
}

.check input {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin: 0;
  border-radius: 7px;
  background: var(--surface-grid);
  box-shadow: inset 0 0 0 1.5px var(--text-subtle);
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.check input:checked {
  background: var(--primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Cpath d='M6 11.5l3.4 3.4L16 8' fill='none' stroke='%230e0c0e' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 22px 22px no-repeat;
  box-shadow: none;
}

.check input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.check a {
  color: var(--text);
}

.sheet .btn-primary {
  width: 100%;
  margin-top: 24px;
}

.form-error {
  min-height: 1.4em;
  margin-top: 12px;
  color: var(--secondary);
  font-size: 14px;
}

.sheet-done {
  padding: 18px 0 6px;
  text-align: center;
}

.sheet-done img {
  width: 72px;
  margin: 0 auto 18px;
}

.sheet-done h2 {
  margin: 0 0 10px;
}

.sheet-done p {
  color: var(--text-2);
}

.honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media (max-width: 559px) {
  .sheet {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 24px);
    margin: auto 0 0;
    border-radius: 30px 30px 0 0;
  }

  .sheet[open] {
    animation-name: sheet-up;
  }

  .sheet-inner {
    padding-bottom: max(28px, env(safe-area-inset-bottom));
  }

  @keyframes sheet-up {
    from { transform: translateY(100%); }
    to { transform: none; }
  }
}

@media (prefers-reduced-motion: reduce) {
  .sheet[open] {
    animation: none;
  }
}

/* ── A phone: one screen, no scrolling ───────────────────────────────────── */
/* The header, the headline, then a carousel whose first slide says what
   Twosday is and whose others are the five phones, then the footer. Last in
   the file, so it overrides the rules above. */

@media (max-width: 699px) {
  .page {
    height: 100vh;
    height: 100dvh;
    min-height: 520px;
  }

  .main {
    min-height: 0;
    gap: 12px;
    padding-top: 6px;
    padding-bottom: 8px;
  }

  .intro .about {
    display: none;
  }

  .stage {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    container-type: size;
  }

  /* One slide in the middle, and the edge of the next phone showing either
     side. A phone takes the height left, less its caption and the dots; a
     slide is as wide as leaves --peek of its neighbour's phone in view. The
     row runs the full width of the screen: the stage and both gutters. */
  .phones {
    --peek: 22px;
    --row-w: calc(100cqw + 2 * var(--gutter));
    --phone-w: min(260px, calc((100cqh - 64px) / 2.236), 70cqw);
    --slide-w: calc((var(--row-w) + var(--phone-w) * 1.068 - 2 * var(--peek)) / 2);
    flex: 1;
    min-height: 0;
    gap: 0;
    padding: 0 calc((var(--row-w) - var(--slide-w)) / 2);
    overscroll-behavior-x: contain;
  }

  .phones > li {
    flex: 0 0 var(--slide-w);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    scroll-snap-align: center;
    scroll-snap-stop: always;
  }

  .device {
    --w: var(--phone-w);
  }

  /* What Twosday is: its first sentence in the headline's face, the block a
     little above the middle. */
  .slide-about {
    padding: 0 4px 28px;
    color: var(--text-3);
    font-size: 16px;
    line-height: 1.5;
    text-align: center;
    text-wrap: balance;
    transition: opacity 0.3s var(--ease-out), visibility 0s;
    /* Safari kept painting this slide as it first drew it, whatever its
       opacity or visibility became, until it had a layer of its own. */
    will-change: opacity;
  }

  /* Its text runs nearly to its edges, so once you've swiped past it, it
     fades: only phones peek in from the sides. Hidden too once faded, so its
     button can't be tapped off to the side. */
  .js .slide-about:not(.is-shown),
  .js .phones > li:not(.is-shown) .caption {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s var(--ease-out), visibility 0s 0.3s;
  }

  .phones .caption {
    transition: opacity 0.3s var(--ease-out), visibility 0s;
  }
  .slide-about p {
    margin: 0;
  }

  .slide-about p + p {
    margin-top: 14px;
  }

  .slide-lead {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 360;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--text);
  }

  .slide-about .slide-join {
    margin-top: 24px;
  }

  .dots {
    display: flex;
    flex: none;
    justify-content: center;
  }

  .dot {
    position: relative;
    width: 22px;
    height: 20px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
  }

  /* A dot, and a short pill for the slide in view. */
  .dot::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    border-radius: 999px;
    background: var(--text-subtle);
    transition: width 0.25s var(--ease-out), margin 0.25s var(--ease-out), background-color 0.2s;
  }

  .dot[aria-current="true"]::after {
    width: 16px;
    margin-left: -8px;
    background: var(--text-2);
  }

  /* The footer on one line: the company, and a ⋯ for the rest. */
  .footer {
    flex-wrap: nowrap;
    gap: 12px;
    padding-top: 8px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    font-size: 13px;
  }

  .footer-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 32px;
    margin-right: -8px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--text-2);
    cursor: pointer;
  }

  .footer-more svg {
    fill: currentColor;
  }

  /* Its menu, just above the footer at the right. Closed, it isn't there. */
  .footer-links[popover] {
    display: none;
  }

  .footer-links[popover]:is(:popover-open, .is-open) {
    position: fixed;
    inset: auto var(--gutter) calc(58px + env(safe-area-inset-bottom)) auto;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 220px;
    padding: 6px;
    border: 1px solid var(--stroke);
    border-radius: 18px;
    background: var(--bg-base);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
    font-size: 15px;
  }

  .footer-links[popover] a,
  .footer-links[popover] .motion-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    color: var(--text-2);
    text-align: left;
  }
}
