/*
 * Magpie's site, in Dusk: the app's dark look (apps/ios/Sources/Theme.swift), and the only look the
 * site has. The Afterglow sky, warm surfaces and never plain white or black, the app's orange, rounded
 * type. Every byte is the site's own: no font, script or image comes from another host
 * (firebase.json's Content-Security-Policy, held by no-third-party.test.ts).
 */

/* Nunito, self-hosted (SIL OFL 1.1, fonts/OFL.txt), for browsers with no rounded system face. Apple's
   browsers draw SF Pro Rounded through ui-rounded and never fetch it. */
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("/fonts/nunito-latin.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("/fonts/nunito-latin-ext.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

:root {
  color-scheme: dark;

  /* The sky: Dusk's Afterglow, its wash and its horizon glow (Theme.duskMoods, the first mood). */
  --sky-top: #1e1418;
  --sky-mid: #29191a;
  --sky-low: #3a2019;
  --glow: rgb(192 96 46 / 0.38);
  --glow-none: rgb(192 96 46 / 0);

  /* Type. --ink-3 is the site's caption colour: textMuted's hue, lifted to clear 4.5:1 on the glow's
     brightest pixel, since a page carries more small reading than an app screen. */
  --ink: #fff3ea;
  --ink-2: #d8c3b5;
  --ink-3: #c9b0a0;
  --ink-4: #a88e7e;

  /* Surfaces, warm and lifted off the sky. */
  --card-top: rgb(62 45 38 / 0.92);
  --card-bottom: rgb(51 36 31 / 0.92);
  --well: rgb(255 236 220 / 0.06);
  --well-hover: rgb(255 236 220 / 0.09);
  --line: rgb(255 220 190 / 0.14);
  --edge: rgb(255 220 190 / 0.3);

  /* The orange. */
  --accent: #ff8a33;
  --on-accent: #2b1e1a;
  --accent-text: #ffb071;
  --accent-tint: rgb(255 138 51 / 0.14);
  --accent-ring: rgb(255 138 51 / 0.22);

  /* The constellation, in My Life's colours. */
  --star-1: #ff9a4d;
  --star-2: #5fd0c2;
  --star-3: #c4a2f0;
  --star-4: #f0c25a;
  --star-5: #f28aa2;

  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --page: 44rem;
  --gutter: 20px;
  --radius: 16px;
  --radius-control: 14px;
  --radius-card: 20px;
}

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

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

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  color: var(--ink-2);
  background: transparent;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* The sky stays put while the page moves over it, as it does behind every screen in the app. */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  z-index: -1;
  height: 100vh;
  height: 100lvh;
  pointer-events: none;
  background:
    radial-gradient(circle 620px at 50% 115%, var(--glow) 149px, var(--glow-none) 620px),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 50%, var(--sky-low) 100%);
}

::selection {
  color: var(--ink);
  background: rgb(255 138 51 / 0.35);
}

[hidden] {
  display: none !important;
}

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

a {
  color: var(--accent-text);
  text-decoration-color: rgb(255 176 113 / 0.45);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: text-decoration-color 160ms ease;
}

a:hover {
  text-decoration-color: currentColor;
}

h1,
h2,
h3 {
  color: var(--ink);
  text-wrap: balance;
}

p {
  margin: 0 0 1em;
}

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

/* Header */

.top {
  padding-top: env(safe-area-inset-top);
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 68px;
}

/* Mindpocket's lockup, the mark and the name: the name at 19 px, the lockup 1.18 times as tall. */
.mark {
  display: inline-flex;
  align-items: center;
  font-size: 1.1875rem;
  text-decoration: none;
}

.mark img {
  width: auto;
  height: 1.18em;
}

.bar nav {
  display: flex;
  gap: 4px;
  margin-right: -12px;
}

.bar nav a {
  padding: 8px 12px;
  color: var(--ink-2);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 999px;
  transition:
    color 160ms ease,
    background-color 160ms ease;
}

.bar nav a:hover {
  color: var(--ink);
  background: var(--well);
}

.bar nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.45em;
}

/* The sky over each page's title, and its quiet constellation */

.hero {
  position: relative;
  padding: clamp(128px, 26vw, 156px) 0 0;
}

.stars {
  position: absolute;
  top: 4px;
  right: -8px;
  width: min(400px, 88%);
  height: auto;
  overflow: visible;
  pointer-events: none;
}

.stars .lines {
  fill: none;
  stroke: rgb(255 220 190 / 0.16);
  stroke-width: 1;
  stroke-linecap: round;
}

.stars .s1 {
  fill: var(--star-1);
}

.stars .s2 {
  fill: var(--star-2);
}

.stars .s3 {
  fill: var(--star-3);
}

.stars .s4 {
  fill: var(--star-4);
}

.stars .s5 {
  fill: var(--star-5);
}

.stars .dust {
  fill: var(--ink);
  opacity: 0.4;
}

.hero h1 {
  position: relative;
  max-width: 15ch;
  margin: 0;
  font-size: clamp(2.125rem, 1.5rem + 3.2vw, 3.375rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

/* The home heading breaks after "kind". Wide enough for that line, and no wider. */
.home .hero h1 {
  max-width: 14em;
}

.home .hero .pitch {
  position: relative;
  max-width: 22rem;
  margin: 18px 0 0;
  color: var(--ink-2);
  font-size: 1.1875rem;
  line-height: 1.45;
}

/* The waitlist: a question page, as the app draws one. Title, Magpie's line, open fields, a capsule. */

.waitlist {
  max-width: 34rem;
  margin-top: clamp(48px, 10vw, 72px);
}

.waitlist h2,
.help h2 {
  margin: 0 0 8px;
  font-size: clamp(1.5rem, 1.3rem + 1vw, 1.75rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.line {
  margin-bottom: 32px;
  line-height: 1.55;
}

form {
  margin: 0;
}

.field {
  margin: 0 0 32px;
}

fieldset.field {
  min-width: 0;
  padding: 0;
  border: 0;
}

.field > label[for],
legend {
  display: block;
  margin: 0 0 10px;
  padding: 0;
  color: var(--ink);
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.35;
}

.hint {
  margin: -4px 0 12px;
  color: var(--ink-3);
  font-size: 0.9375rem;
  line-height: 1.45;
}

.hint + .choice {
  margin-top: 0;
}

input[type="email"],
input[type="text"] {
  width: 100%;
  min-height: 56px;
  margin: 0;
  padding: 14px 16px;
  color: var(--ink);
  font: inherit;
  font-size: 1.1875rem;
  line-height: 1.3;
  background: var(--well);
  border: 1px solid var(--edge);
  border-radius: var(--radius-control);
  caret-color: var(--accent);
  -webkit-appearance: none;
  appearance: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

input[type="email"]:hover,
input[type="text"]:hover {
  background: var(--well-hover);
}

input[type="email"]:focus,
input[type="text"]:focus {
  outline: none;
  background: var(--well-hover);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}

input::placeholder {
  color: var(--ink-4);
  opacity: 1;
}

/* AutoFill paints its own light fill; keep the field warm and the words readable. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  box-shadow: 0 0 0 100px #33241f inset;
  transition: background-color 600000s 0s;
}

.choice {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 54px;
  margin-top: 8px;
  padding: 12px 16px;
  color: var(--ink);
  font-size: 1.0625rem;
  line-height: 1.3;
  background: rgb(255 236 220 / 0.035);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background-color 160ms ease;
}

.choice:hover {
  background: var(--well);
}

.choice:has(input:checked) {
  background: var(--accent-tint);
  border-color: rgb(255 138 51 / 0.55);
}

.choice:has(input:focus-visible) {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
}

input[type="radio"],
input[type="checkbox"] {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  background: transparent center / 14px 14px no-repeat;
  border: 2px solid var(--ink-4);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition:
    border-color 160ms ease,
    background-color 160ms ease;
}

input[type="radio"] {
  border-radius: 50%;
}

input[type="radio"]:checked {
  background-image: radial-gradient(circle, var(--accent) 0 5px, transparent 5.5px);
  background-size: auto;
  border-color: var(--accent);
}

.choice input[type="radio"]:focus-visible {
  outline: none;
}

/* The tick: shown once an answer needs it, where a browser can tell (every browser shows it otherwise). */
.consent {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 12px;
  padding: 16px;
  color: var(--ink-2);
  font-size: 0.9375rem;
  line-height: 1.5;
  background: linear-gradient(180deg, var(--card-top), var(--card-bottom));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.consent input[type="checkbox"] {
  margin-top: 1px;
  border-radius: 7px;
}

.consent input[type="checkbox"]:checked {
  background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2.6 7.4l2.9 2.9 5.9-6.6' fill='none' stroke='%232b1e1a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  border-color: var(--accent);
}

@supports selector(:has(*)) {
  .consent {
    display: none;
  }

  fieldset:has(input[name="adhd"]:checked:not([value=""])) .consent {
    display: flex;
    border-color: rgb(255 138 51 / 0.45);
    animation: rise 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

/* The ritual's capsule: orange when it can send, quiet while it cannot. */
button[type="submit"] {
  display: block;
  width: 100%;
  min-height: 56px;
  margin: 8px 0 0;
  padding: 14px 24px;
  color: var(--on-accent);
  font: inherit;
  font-size: 1.125rem;
  font-weight: 700;
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 12px 28px -14px rgb(255 138 51 / 0.7);
  cursor: pointer;
  transition:
    transform 120ms ease,
    filter 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

button[type="submit"]:hover:not(:disabled) {
  filter: brightness(1.06);
}

button[type="submit"]:active:not(:disabled) {
  transform: scale(0.985);
}

button[type="submit"]:disabled {
  color: var(--ink-3);
  background: rgb(255 236 220 / 0.1);
  box-shadow: none;
  cursor: default;
}

/* One line under the capsule, led by the app's orange dot, as Capture's receipt is. */
.status {
  min-height: 1.5em;
  margin: 16px 0 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.45;
}

.status:not(:empty) {
  display: flex;
  gap: 12px;
}

.status:not(:empty)::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin: 0.5em 2px 0;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--accent-ring);
}

.thanks h2 {
  display: flex;
  align-items: center;
  gap: 14px;
}

.thanks h2::before {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow:
    0 0 0 5px var(--accent-ring),
    0 0 20px 2px rgb(255 138 51 / 0.45);
}

.thanks h2:focus {
  outline: none;
}

.thanks p {
  font-size: 1.125rem;
  line-height: 1.55;
}

.fine {
  margin: 12px 0 0;
  color: var(--ink-3);
  font-size: 0.9375rem;
  line-height: 1.55;
}

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

/* Help: where the App Store's Support URL lands (/#help). */
.help {
  max-width: 34rem;
  margin-top: clamp(48px, 10vw, 80px);
  padding-top: 36px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 24px;
}

.help p {
  font-size: 1.0625rem;
}

.write {
  margin: 20px 0 22px;
}

.write a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 20px 10px 16px;
  color: var(--accent-text);
  font-weight: 650;
  text-decoration: none;
  background: rgb(255 138 51 / 0.1);
  border: 1px solid rgb(255 176 113 / 0.35);
  border-radius: 999px;
  overflow-wrap: anywhere;
  transition:
    background-color 160ms ease,
    border-color 160ms ease;
}

.write a::before {
  content: "";
  flex: none;
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='3'/%3E%3Cpath d='M4 7.5l8 5.5 8-5.5'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='3'/%3E%3Cpath d='M4 7.5l8 5.5 8-5.5'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.write a:hover {
  background: rgb(255 138 51 / 0.16);
  border-color: rgb(255 176 113 / 0.6);
}

/* Footer */

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 24px;
  margin-top: auto;
  padding: 72px 0 calc(32px + env(safe-area-inset-bottom));
  color: var(--ink-3);
  font-size: 0.875rem;
}

.foot p {
  margin: 0;
}

/* A postcode never breaks across lines. */
.nowrap {
  white-space: nowrap;
}

.foot a {
  color: var(--ink-2);
  text-decoration-color: rgb(216 195 181 / 0.4);
}

/* The privacy page: the same sky, then long-form reading in short paragraphs. */

.policy .hero {
  padding-top: clamp(96px, 20vw, 140px);
}

.updated {
  position: relative;
  margin: 12px 0 0;
  color: var(--ink-3);
  font-size: 0.9375rem;
}

/* A reading measure under the sky's full width. */
.policy > :not(.hero) {
  max-width: 38rem;
}

.policy .lede {
  margin: 28px 0 0;
  color: var(--ink);
  font-size: 1.1875rem;
  line-height: 1.55;
}

.policy > .summary {
  max-width: calc(38rem + 8px);
  margin: 32px -4px 0;
  padding: 24px 22px 10px;
  background: linear-gradient(180deg, var(--card-top), var(--card-bottom));
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: 0 24px 48px -28px rgb(0 0 0 / 0.7);
}

/* The seam between the short version and the full policy: a hairline over the words on a phone, a
   hairline either side of them where there is room. */
.part {
  margin: 56px 0 8px;
  padding-top: 20px;
  color: var(--ink-3);
  font-size: 0.9375rem;
  border-top: 1px solid var(--line);
}

@media (min-width: 720px) {
  .part {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-top: 0;
    text-align: center;
    border-top: 0;
  }

  .part::before,
  .part::after {
    content: "";
    flex: 1;
    min-width: 24px;
    height: 1px;
    background: var(--line);
  }
}

.policy h2 {
  margin: 48px 0 12px;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.policy h3 {
  margin: 28px 0 6px;
  font-size: 1.125rem;
  font-weight: 650;
  line-height: 1.35;
}

.policy h2 + h3 {
  margin-top: 16px;
}

.policy .part + h2 {
  margin-top: 32px;
}

.policy .summary h2 {
  margin: 0 0 10px;
  font-size: 1.375rem;
}

.policy .summary h3 {
  margin: 22px 0 6px;
}

.policy ul {
  margin: 0 0 1em;
  padding: 0;
  list-style: none;
}

.policy li {
  position: relative;
  margin: 8px 0;
  padding-left: 22px;
}

.policy li::before {
  content: "";
  position: absolute;
  top: 0.68em;
  left: 4px;
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
}

/* The stars a tick throws (sparkle.js, for the home page and the free tools): each a four-pointed sparkle in one of
   My Life's colours. */
.spark {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  pointer-events: none;
  background: var(--c, var(--accent));
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 0c.7 6.6 5.4 11.3 12 12-6.6.7-11.3 5.4-12 12-.7-6.6-5.4-11.3-12-12C6.6 11.3 11.3 6.6 12 0z'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 0c.7 6.6 5.4 11.3 12 12-6.6.7-11.3 5.4-12 12-.7-6.6-5.4-11.3-12-12C6.6 11.3 11.3 6.6 12 0z'/%3E%3C/svg%3E")
    center / contain no-repeat;
  filter: drop-shadow(0 0 4px var(--c, var(--accent)));
}

.spark.round {
  border-radius: 50%;
  -webkit-mask: none;
  mask: none;
}

/* Motion: a slow twinkle in three stars, none for anyone who asked for less. */

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  .stars .tw-a {
    animation: twinkle 7s ease-in-out infinite;
  }

  .stars .tw-b {
    animation: twinkle 9s ease-in-out -3s infinite;
  }

  .stars .tw-c {
    animation: twinkle 11s ease-in-out -6s infinite;
  }
}

@keyframes twinkle {
  50% {
    opacity: 0.35;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

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

  /* A wide window keeps the glow's height and spreads it along the horizon, as a phone's width does. */
  body::before {
    background:
      radial-gradient(
        ellipse max(620px, 60vw) 620px at 50% 115%,
        var(--glow) 24%,
        var(--glow-none) 100%
      ),
      linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 50%, var(--sky-low) 100%);
  }

  .bar {
    min-height: 80px;
  }

  .stars {
    top: 24px;
    right: -24px;
  }
}

/* High contrast: the system draws the controls, and the sky steps aside. */
@media (forced-colors: active) {
  body::before {
    display: none;
  }

  input[type="radio"],
  input[type="checkbox"] {
    -webkit-appearance: auto;
    appearance: auto;
  }
}

/* Paper: dark words on the page, no sky. */
@media print {
  :root {
    color-scheme: light;
    --ink: #1e1418;
    --ink-2: #3e2c20;
    --ink-3: #5a4338;
    --accent-text: #8a3a0c;
    --line: #d8c3b5;
  }

  html {
    background: none;
  }

  body::before,
  .stars,
  .spark,
  .top nav {
    display: none;
  }

  /* The lockup's cream name would vanish on paper: the one for light grounds, in the ink. */
  .mark img {
    content: url("/mindpocket-lockup-for-light.svg");
  }

  .policy > .summary {
    background: none;
    box-shadow: none;
  }
}
