:root {
  color-scheme: light dark;

  --bg: #fbf6ee;
  --bg-raised: #fffdf9;
  --bg-sunk: #f3eadc;
  --text: #2a1c14;
  --muted: #6f5a4c;
  --line: #e6d9c6;
  --red: #9e2433;
  --red-hover: #861c2a;
  --on-red: #fff8f0;
  --navy: #1b2340;
  --gold: #b9853a;
  --shadow: 0 1px 2px rgb(42 28 20 / 0.06), 0 18px 40px -18px rgb(42 28 20 / 0.35);

  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, system-ui, sans-serif;
  --radius: 18px;
  --page: min(1120px, 100% - 32px);

  @media (prefers-color-scheme: dark) {
    --bg: #17110e;
    --bg-raised: #221913;
    --bg-sunk: #1d1511;
    --text: #f4ebe1;
    --muted: #bba897;
    --line: #3a2b22;
    --red: #c63b4c;
    --red-hover: #d64e5f;
    --on-red: #fff8f0;
    --gold: #d9a85a;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 18px 40px -18px rgb(0 0 0 / 0.7);
  }

  accent-color: var(--red);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;

  @media (prefers-reduced-motion: reduce) {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
}

a {
  color: inherit;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

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

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

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.8em 1.4em;
  border-radius: 999px;
  background: var(--red);
  color: var(--on-red);
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.2) inset, 0 8px 20px -10px var(--red);
  transition: background-color 0.2s, translate 0.2s;

  &:hover {
    background: var(--red-hover);
    translate: 0 -1px;
  }

  &:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 3px;
  }

  & svg {
    width: 1.15em;
    height: 1.15em;
  }

  &.small {
    padding: 0.5em 1.1em;
    font-size: 0.9rem;
  }

  &.ghost {
    background: transparent;
    color: var(--text);
    box-shadow: inset 0 0 0 1.5px var(--line);

    &:hover {
      background: var(--bg-sunk);
    }
  }
}

/* Header */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px max(16px, (100% - 1120px) / 2);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);

  & nav {
    display: flex;
    gap: 22px;
    margin-left: auto;
    font-size: 0.95rem;

    & a {
      color: var(--muted);
      text-decoration: none;

      &:hover {
        color: var(--text);
      }

      &.credit {
        padding-left: 22px;
        border-left: 1px solid var(--line);
      }
    }
  }

  @media (width < 720px) {
    & nav {
      display: none;
    }

    & .button {
      margin-left: auto;
    }
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-weight: 650;
  font-size: 1.25rem;
  text-decoration: none;
}

/* Hero */

.hero {
  width: var(--page);
  margin: 0 auto;
  padding: 64px 0 24px;
  text-align: center;

  & .eyebrow {
    margin: 0 0 14px;
    color: var(--red);
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  & h1 {
    font-size: clamp(2.6rem, 7vw, 5.2rem);
  }

  & .lede {
    max-width: 620px;
    margin: 20px auto 0;
    color: var(--muted);
    font-size: clamp(1.05rem, 2vw, 1.25rem);
  }

  & .cta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 30px;
  }

  & .meta {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 0.85rem;
  }

  & .hint {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
  }
}

/* The demo: a little Mac desktop with a wooden floor */

.stage {
  --icon: clamp(54px, 8.4%, 84px);

  position: relative;
  margin: 48px 0 0;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius);
  overflow: hidden;
  background: #8e5f3b url("assets/floor.jpg") center / cover;
  box-shadow: var(--shadow), 0 0 0 1px rgb(0 0 0 / 0.08);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;

  /* Window light from the upper left, like the app's floor. */
  &::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
      radial-gradient(ellipse 60% 70% at 18% 8%, rgb(255 236 200 / 0.28), transparent 70%),
      radial-gradient(ellipse 120% 90% at 50% 50%, transparent 55%, rgb(0 0 0 / 0.28));
    pointer-events: none;
  }

  @media (width < 720px) {
    --icon: 52px;

    aspect-ratio: 4 / 3.4;
    margin-top: 36px;
    border-radius: 14px;
  }

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

  & .rug-shadow {
    z-index: 2;
  }

  & .rug-gl {
    z-index: 3;
  }

  /* Shown until (or unless) the interactive rug starts. */
  & .rug-static {
    position: absolute;
    z-index: 3;
    left: 42%;
    top: 56%;
    width: 43%;
    height: auto;
    translate: -50% -50%;
    rotate: -3.4deg;
    filter: drop-shadow(6px 10px 12px rgb(0 0 0 / 0.4));
  }

  &.is-live .rug-static {
    display: none;
  }

  & .effects {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
  }
}

.menubar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 26px;
  padding: 0 14px;
  background: rgb(255 248 240 / 0.55);
  backdrop-filter: blur(16px) saturate(1.6);
  color: #241810;
  font: 500 12.5px/1 var(--sans);
  text-align: left;

  & .apple {
    width: 12px;
    height: 14px;
    background: currentColor;
    clip-path: path("M8.5 2.6c.5-.6.9-1.5.8-2.4-.8 0-1.7.5-2.2 1.2-.5.5-.9 1.4-.8 2.3.9 0 1.7-.5 2.2-1.1zM9.3 3.9c-1.2-.1-2.2.7-2.8.7-.6 0-1.4-.6-2.4-.6C2.9 4 1.8 4.7 1.2 5.8 0 8 .9 11.2 2.1 12.9c.6.8 1.2 1.7 2.1 1.7.8 0 1.2-.5 2.2-.5s1.3.5 2.2.5c.9 0 1.5-.8 2-1.7.6-.9.9-1.8.9-1.9 0 0-1.8-.7-1.8-2.7 0-1.7 1.4-2.5 1.4-2.5-.8-1.2-2-1.3-2.4-1.4z");
  }

  & .right {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;

    & svg {
      width: 20px;
      height: 18px;
    }
  }

  @media (width < 720px) {
    & span:not(.right, .apple),
    & .right > span {
      display: none;
    }
  }
}

.icon {
  position: absolute;
  z-index: 1;
  left: var(--x);
  top: var(--y);
  width: var(--icon);
  translate: -50% 0;
  display: grid;
  justify-items: center;
  gap: 2px;
  cursor: grab;
  touch-action: none;

  & svg {
    width: 76%;
    aspect-ratio: 1;
    filter: drop-shadow(0 2px 2px rgb(0 0 0 / 0.3));
  }

  & span {
    max-width: 130%;
    padding: 1px 5px;
    border-radius: 4px;
    color: #fff;
    font: 600 11px/1.25 var(--sans);
    text-align: center;
    text-shadow: 0 1px 2px rgb(0 0 0 / 0.75);
    overflow-wrap: anywhere;
  }

  &.dragging {
    z-index: 7;
    cursor: grabbing;
    scale: 1.06;

    & span {
      background: rgb(30 90 200 / 0.85);
      text-shadow: none;
    }
  }

  @media (width < 720px) {
    & span {
      font-size: 9.5px;
    }
  }
}

.status {
  position: absolute;
  z-index: 6;
  left: 12px;
  bottom: 12px;
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgb(23 17 14 / 0.6);
  backdrop-filter: blur(10px);
  color: #fff8f0;
  font-size: 0.8rem;
  opacity: 0;
  translate: 0 6px;
  transition: opacity 0.3s, translate 0.3s;

  &.shown {
    opacity: 1;
    translate: 0;
  }
}

.tidy {
  position: absolute;
  z-index: 6;
  right: 12px;
  bottom: 12px;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: rgb(255 248 240 / 0.7);
  backdrop-filter: blur(10px);
  color: #241810;
  font: 600 0.8rem var(--sans);
  cursor: pointer;

  &:hover {
    background: rgb(255 248 240 / 0.9);
  }

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

.puff {
  position: absolute;
  width: 9px;
  height: 9px;
  margin: -4.5px;
  border-radius: 50%;
  background: rgb(240 226 205 / 0.75);
  filter: blur(1.5px);
  animation: puff 0.9s ease-out forwards;
}

@keyframes puff {
  to {
    translate: var(--dx) var(--dy);
    scale: 2.4;
    opacity: 0;
  }
}

/* Sections */

.section {
  width: var(--page);
  margin: 0 auto;
  padding: 96px 0 0;

  & > h2 {
    font-size: clamp(2rem, 4.5vw, 3.1rem);
    text-align: center;
  }
}

.section-lede {
  max-width: 560px;
  margin: 14px auto 0;
  color: var(--muted);
  text-align: center;
  font-size: 1.1rem;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 16px;
  margin-top: 44px;
}

.card {
  padding: 26px;
  border-radius: var(--radius);
  background: var(--bg-raised);
  border: 1px solid var(--line);

  & svg {
    width: 40px;
    height: 40px;
    padding: 8px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--red) 12%, transparent);
    fill: none;
    stroke: var(--red);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  & h3 {
    margin-top: 18px;
    font-size: 1.3rem;
  }

  & p {
    margin: 8px 0 0;
    color: var(--muted);
  }
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 16px;
  margin: 44px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;

  & li {
    counter-increment: step;
    padding: 26px;
    border-radius: var(--radius);
    background: var(--bg-sunk);

    &::before {
      content: counter(step);
      display: grid;
      place-items: center;
      width: 40px;
      height: 40px;
      border-radius: 50%;
      background: var(--navy);
      color: #f4ebe1;
      font: 650 1.2rem var(--serif);
      box-shadow: 0 0 0 3px var(--bg-sunk), 0 0 0 4.5px var(--gold);
    }
  }

  & h3 {
    margin-top: 18px;
    font-size: 1.3rem;
  }

  & p {
    margin: 8px 0 0;
    color: var(--muted);
  }
}

.inline-glyph {
  display: inline-block;
  width: 20px;
  height: 18px;
  vertical-align: -3px;
  color: var(--text);
}

.install {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 40px;
  align-items: start;

  & h2 {
    font-size: clamp(2rem, 4.5vw, 3.1rem);
  }

  @media (width < 820px) {
    grid-template-columns: 1fr;
  }
}

.install-steps {
  margin: 28px 0 0;
  padding-left: 1.3em;

  & li {
    margin-bottom: 14px;
    padding-left: 6px;

    &::marker {
      color: var(--red);
      font-weight: 700;
    }
  }
}

.download-card {
  display: grid;
  justify-items: center;
  padding: 32px 26px;
  border-radius: var(--radius);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-align: center;

  & img {
    width: 128px;
    height: 128px;
  }

  & h3 {
    margin-top: 10px;
    font-size: 1.5rem;
  }

  & p {
    margin: 6px 0 20px;
    color: var(--muted);
    font-size: 0.95rem;
  }
}

.faq {
  max-width: 760px;

  & > h2 {
    margin-bottom: 32px;
  }

  & details {
    border-bottom: 1px solid var(--line);
  }

  & summary {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 0;
    font-weight: 600;
    font-size: 1.05rem;
    cursor: pointer;
    list-style: none;

    &::-webkit-details-marker {
      display: none;
    }

    &::after {
      content: "+";
      color: var(--red);
      font-size: 1.4rem;
      line-height: 1;
      transition: rotate 0.2s;
    }

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

  & details[open] summary::after {
    rotate: 45deg;
  }

  & details p {
    margin: 0 0 20px;
    color: var(--muted);
  }
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  width: var(--page);
  margin: 110px auto 0;
  padding: 28px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;

  & p {
    margin: 0;
  }

  & p a {
    color: var(--text);
    text-underline-offset: 3px;
  }

  & .brand {
    color: var(--text);
    font-size: 1.05rem;
  }
}

/* Scroll reveal: a decorative fade-up, where supported and wanted. */

@media (prefers-reduced-motion: no-preference) {
  @supports ((animation-timeline: view()) and (animation-range: entry)) {
    @keyframes reveal {
      from {
        opacity: 0;
        translate: 0 28px;
      }
    }

    .reveal {
      animation: reveal linear backwards;
      animation-timeline: view();
      animation-range: entry 0% entry 70%;
    }
  }
}
