/* Colours are the app's own, copied from Features/DesignSystem/Theme.swift,
   light and dark. The type is the system rounded face: on an iPhone that is
   SF Rounded, the same face the app uses, at no download cost.

   Browsers without a system rounded face (Chrome, Android) get Nunito, served
   from this site. A browser only downloads it when it needs it, so Safari
   never does, and no visitor's request ever goes to a font host. */

@font-face {
  font-family: "Nunito";
  src: url("/assets/fonts/nunito.woff2") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  --blue: #2279DC;
  --navy: #004A9C;
  --green: #4AC06C;
  --green-deep: #09672E;
  --sky: #E4F0FF;
  --sky-blob: #CCE4FF;
  --cream: #FDFCF8;
  --card: #FFFFFF;
  --chip: #EDF2F9;
  --hairline: #E6ECF4;
  --text: #1B2735;
  --text-2: #506580;
  --text-3: #5F6E80;
  --action: #004A9C;
  --on-action: #FFFFFF;
  --error: #B3261E;
  --shadow: 0 10px 30px rgba(0, 74, 156, .10), 0 2px 6px rgba(0, 74, 156, .06);
  --radius-card: 20px;
  --radius-pill: 28px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --blue: #5AA1F0;
    --navy: #BBD8FF;
    --green: #56CE79;
    --green-deep: #A7E8BC;
    --sky: #0E1A2B;
    --sky-blob: #15263C;
    --cream: #12161C;
    --card: #1B2331;
    --chip: #232C3B;
    --hairline: #2C3749;
    --text: #F2F6FC;
    --text-2: #A9BACE;
    --text-3: #94A4B8;
    --action: #5AA1F0;
    --on-action: #0E1A2B;
    --error: #FF8570;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--sky);
  color: var(--text);
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.55;
  /* Nunito joins "ffi" into one glyph, which reads oddly in "office" at
     headline size. */
  font-variant-ligatures: no-common-ligatures;
  overflow-x: hidden;
}

h1, h2, h3, p, ol, ul, figure, fieldset { margin: 0; padding: 0; }
ol, ul { list-style: none; }
fieldset { border: 0; min-width: 0; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--navy); text-underline-offset: .18em; }

.wrap { width: min(100% - 2.5rem, 68rem); margin-inline: auto; }

.sr, .skip:not(:focus) {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.skip:focus {
  position: fixed; top: .75rem; left: .75rem; z-index: 10;
  background: var(--card); padding: .6rem 1rem; border-radius: 12px;
}

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

/* The honeypot. Off-screen rather than display:none, which some bots skip. */
.trap { position: absolute; left: -200vw; width: 1px; height: 1px; opacity: 0; }

/* ---------- Header ---------- */

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding-block: 1.25rem;
  position: relative; z-index: 1;
}
.wordmark { font-size: 1.6rem; font-weight: 800; letter-spacing: -.01em; color: var(--navy); }
.soon {
  font-size: .8125rem; font-weight: 700; color: var(--navy);
  background: var(--card); padding: .45rem .9rem; border-radius: var(--radius-pill);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  display: grid; gap: 2.5rem;
  padding-block: 1.5rem 3.5rem;
}
/* The app's home screen has one off-centre circle behind the header. Same one. */
.hero::before {
  content: ""; position: absolute; z-index: 0;
  width: min(38rem, 120vw); aspect-ratio: 1; border-radius: 50%;
  background: var(--sky-blob);
  top: -14rem; right: -16rem;
}
.hero > * { position: relative; z-index: 1; }

/* Both headlines are in the page; variant.js sets data-variant before first
   paint and one pair is hidden. With no script at all, B shows. */
.v-a { display: none; }
[data-variant="a"] .v-a { display: block; }
[data-variant="a"] .v-b { display: none; }

h1 {
  font-size: clamp(2.35rem, 9.5vw, 4.25rem);
  line-height: 1.06; font-weight: 800; letter-spacing: -.015em;
  color: var(--navy);
  text-wrap: balance;
}
h1 .accent { color: var(--green-deep); }

.lede { font-size: 1.1875rem; color: var(--text-2); max-width: 34rem; }
.hero .lede { margin-top: 1.1rem; }

/* ---------- Signup form ---------- */

.signup { margin-top: 1.75rem; max-width: 32rem; }

.field {
  display: flex; flex-direction: column; gap: .6rem;
}
.field input {
  flex: 1; min-width: 0;
  font: inherit; color: var(--text);
  background: var(--card);
  border: 2px solid var(--hairline); border-radius: 16px;
  padding: .95rem 1.1rem;
}
.field input::placeholder { color: var(--text-3); }
.field input:focus-visible { border-color: var(--blue); outline-offset: 0; }

button {
  font: inherit; font-weight: 800; cursor: pointer;
  color: var(--on-action); background: var(--action);
  border: 0; border-radius: 16px;
  padding: .95rem 1.5rem;
  transition: transform .15s ease, filter .15s ease;
}
button:hover { filter: brightness(1.12); }
button:active { transform: scale(.97); }
button[disabled] { opacity: .6; cursor: progress; }
button.quiet { background: var(--chip); color: var(--navy); }

.fine { margin-top: .7rem; font-size: .875rem; color: var(--text-3); }
.status { margin-top: .5rem; font-size: .9375rem; font-weight: 700; min-height: 1.4em; color: var(--green-deep); }
.status.bad { color: var(--error); }

@media (min-width: 30rem) {
  .field { flex-direction: row; }
  .field button { white-space: nowrap; }
}

/* ---------- Hero illustration ---------- */

.hero-art { position: relative; max-width: 26rem; padding-top: 3.25rem; }

.mascot {
  position: absolute; top: -1.25rem; right: 1rem; z-index: 2;
  width: 6.5rem; height: 6.5rem;
  animation: bob 5s ease-in-out infinite;
}

.week {
  background: var(--card); border-radius: 28px; box-shadow: var(--shadow);
  padding: 1.5rem 1.25rem 1.1rem;
}
.week-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem 1rem; }
.week-head strong { font-size: 1.1875rem; font-weight: 800; }
.week-head span { font-size: .875rem; font-weight: 700; color: var(--green-deep); }

.days { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; margin-top: 1.1rem; }
.day { display: grid; gap: .45rem; justify-items: center; font-size: .8125rem; color: var(--text-2); }
.tile {
  width: 100%; aspect-ratio: 1; border-radius: 16px;
  background: var(--chip);
  display: grid; place-items: center; position: relative;
}
.day:not(.done):not(.next) .tile::after {
  content: ""; width: .35rem; height: .35rem; border-radius: 50%; background: var(--text-3);
}
.day.next .tile { background: transparent; border: 2.5px dashed var(--blue); }
.day.done .tile { background: var(--green); }
.tile svg { width: 55%; fill: none; stroke: #fff; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }

.week figcaption { margin-top: .9rem; font-size: .75rem; color: var(--text-3); text-align: center; }

/* ---------- Thanks and survey ---------- */

.thanks { padding-bottom: 3.5rem; }
.thanks:focus { outline: none; }
.card { background: var(--card); border-radius: 28px; box-shadow: var(--shadow); padding: 1.75rem 1.4rem; max-width: 40rem; }
.card h2 { color: var(--green-deep); }
.card > p { margin-top: .6rem; color: var(--text-2); }

.survey { margin-top: 1.75rem; padding-top: 1.5rem; border-top: 2px solid var(--hairline); display: grid; gap: .9rem; }
.survey-intro { font-weight: 700; }
.survey label, .survey legend { font-weight: 700; }
.survey legend { margin-bottom: .5rem; }
.survey select, .survey .other {
  font: inherit; color: var(--text); background: var(--card);
  border: 2px solid var(--hairline); border-radius: 14px; padding: .75rem .9rem; width: 100%;
}
.survey .other { margin-top: .5rem; }
.check { display: flex; align-items: center; gap: .65rem; padding: .4rem 0; font-weight: 500 !important; }
.check input { width: 1.25rem; height: 1.25rem; accent-color: var(--blue); }
.survey button { justify-self: start; }

.share { margin-top: 1.75rem; padding-top: 1.5rem; border-top: 2px solid var(--hairline); }
.share h3 { margin-bottom: .7rem; }

/* ---------- How it works ---------- */

h2 { font-size: clamp(1.6rem, 5vw, 2.25rem); line-height: 1.12; font-weight: 800; letter-spacing: -.01em; color: var(--navy); }
h3 { font-size: 1.1875rem; font-weight: 800; line-height: 1.25; }

.how { padding-block: 4rem; }
.blocks { display: grid; gap: 1rem; margin-top: 1.75rem; }
.block { background: var(--card); border-radius: var(--radius-card); padding: 1.5rem; box-shadow: var(--shadow); }
.block h3 { margin-top: 1rem; }
.block p { margin-top: .45rem; color: var(--text-2); }

.icon { width: 2.75rem; height: 2.75rem; fill: none; stroke: var(--blue); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

@media (min-width: 48rem) {
  .blocks { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Closing ---------- */

.closing { background: var(--cream); padding-block: 4rem; }
.closing .signup { margin-top: 1.25rem; }

/* ---------- Footer ---------- */

.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem 1.5rem;
  padding-block: 1.75rem; font-size: .9375rem; color: var(--text-2);
}
.foot nav { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }
.foot a { color: var(--text-2); }

/* ---------- Privacy policy page ---------- */

.doc { max-width: 42rem; padding-block: 1rem 4rem; }
.doc h1 { font-size: clamp(2rem, 7vw, 3rem); }
.doc h2 { font-size: 1.375rem; margin-top: 2.25rem; }
.doc p, .doc ul { margin-top: .8rem; }
.doc ul { list-style: disc; padding-left: 1.25rem; display: grid; gap: .4rem; }
.doc .meta { color: var(--text-3); font-size: .9375rem; }
.top a.wordmark { text-decoration: none; }

/* ---------- Layout at width ---------- */

@media (min-width: 56rem) {
  .hero { grid-template-columns: 1.15fr .85fr; align-items: center; gap: 3rem; padding-block: 3rem 5.5rem; }
  .hero-art { justify-self: end; width: 100%; }
  .mascot { width: 8rem; height: 8rem; top: -2.75rem; }
  .card { padding: 2.25rem; }
}

/* ---------- Motion ---------- */

@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
@keyframes bob { 50% { transform: translateY(-7px) rotate(-3deg); } }

@media (prefers-reduced-motion: no-preference) {
  .hero-copy > * { animation: rise .6s cubic-bezier(.2, .7, .2, 1) backwards; }
  .hero-copy .lede { animation-delay: .08s; }
  .hero-copy .signup { animation-delay: .16s; }
  .week { animation: rise .7s cubic-bezier(.2, .7, .2, 1) .2s backwards; }
  .day.done .tile { animation: pop .45s cubic-bezier(.3, 1.4, .5, 1) backwards; }
  .day.done:nth-child(1) .tile { animation-delay: .7s; }
  .day.done:nth-child(3) .tile { animation-delay: 1s; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .mascot { animation: none; }
  * { transition: none !important; }
}
