/* Outfit for the "Get Life Done" title only, hosted here too. */
@font-face {
  font-family: Outfit;
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url(fonts/outfit.woff2) format("woff2");
}

/* Figtree, hosted here (no request to Google). SIL Open Font License, see fonts/LICENSE.txt */
@font-face {
  font-family: Figtree;
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url(fonts/figtree.woff2) format("woff2");
}

/* The brand palette is the only set of colours: navy, mint and red, on the
   icon's off-white. Greys are tints of navy. */
:root {
  --navy: #2c337c;
  --mint: #00ddb6;
  --red: #ed2027;
  --paper: #f8f8f8;
  --white: #ffffff;

  --bg: var(--paper);
  --surface: var(--white);
  --ink: var(--navy);
  --ink-soft: color-mix(in srgb, var(--navy) 72%, var(--paper));
  --outline: color-mix(in srgb, var(--navy) 55%, var(--paper));
  --outline-soft: color-mix(in srgb, var(--navy) 18%, var(--paper));
  --primary: var(--navy);
  --on-primary: var(--white);
  --error: var(--red);
  --success: var(--mint);
  --accent: var(--mint);
  --shadow: color-mix(in srgb, var(--navy) 22%, transparent);
}

/* Dark: navy is the background, mint the accent */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--navy);
    --surface: color-mix(in srgb, var(--navy) 85%, var(--white));
    --ink: var(--paper);
    --ink-soft: color-mix(in srgb, var(--paper) 78%, var(--navy));
    --outline: color-mix(in srgb, var(--paper) 55%, var(--navy));
    --outline-soft: color-mix(in srgb, var(--paper) 22%, var(--navy));
    --primary: var(--mint);
    --on-primary: var(--navy);
    --cta-hover: var(--paper);
    --shadow: color-mix(in srgb, color-mix(in srgb, var(--navy) 25%, black) 60%, transparent);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Figtree, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}

main {
  max-width: 480px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
}

h1 {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 0.5rem;
}

h2 {
  font-size: 22px;
  font-weight: 600;
  margin: 1.75rem 0 0.5rem;
}

p,
li {
  margin: 0.5rem 0;
}

ul {
  margin: 0.75rem 0 1.25rem;
  padding-left: 1.25rem;
}

a {
  color: var(--primary);
}

nav {
  margin-bottom: 2rem;
  font-size: 16px;
}

footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--outline-soft);
  font-size: 16px;
  color: var(--ink-soft);
}

.meta {
  font-size: 16px;
  color: var(--ink-soft);
  margin-bottom: 1.5rem;
}

/* Landing page */
.landing {
  text-align: center;
}

.landing header {
  margin: 1.5rem 0 5.5rem;
}

.logo {
  display: block;
  width: 112px;
  height: 112px;
  margin: 0 auto 1.25rem;
  filter: drop-shadow(0 6px 12px var(--shadow));
}

.landing section {
  margin: 0 0 3rem;
}

.landing h2 {
  font-size: 28px;
  text-wrap: balance;
  margin: 0 0 0.75rem;
}

.lead {
  color: var(--ink-soft);
  margin: 0 0 1.5rem;
}

/* The middle column is as wide as the intro line, and the button sits in it;
   the email field and status span the whole width. */
#beta {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  row-gap: 1.25rem;
}

#beta .lead {
  grid-column: 2;
  margin: 0;
  white-space: nowrap;
}

form {
  display: contents;
}

form input[type="email"] {
  grid-column: 1 / -1;
  justify-self: center;
  width: 75%;
  text-align: center;
  padding: 1rem;
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--outline);
  border-radius: 4px;
}

form input[type="email"]:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
  border-color: var(--primary);
}

form input[type="email"]::placeholder {
  color: var(--outline);
}

button {
  grid-column: 2;
  padding: 1rem;
  font: inherit;
  font-size: 18px;
  font-weight: 500;
  color: var(--on-primary);
  background: var(--primary);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
}

.trap {
  position: absolute;
  left: -9999px;
}

/* The message sits in the empty space under the button and never moves the page. */
#status {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin: 0.75rem 0 0;
  font-size: 16px;
  text-align: center;
  color: var(--ink-soft);
}

#status {
  color: var(--error);
}

#status:empty {
  display: none;
}

.done {
  grid-column: 1 / -1;
  margin: 1rem 0;
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  color: var(--success);
}

/* The privacy checklist, like the app intro's last page */
.checks {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(3, auto);
  justify-content: center;
  gap: 0.6rem 2rem;
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.checks li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.checks svg {
  flex: none;
  width: 20px;
  height: 20px;
  fill: var(--primary);
}

/* Landing footer: the two links well apart */
.landing footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 3rem;
}

/* Each link grows away from the middle, so the other one never moves */
.landing footer a:first-child {
  justify-self: end;
}

.landing footer a:last-child {
  justify-self: start;
}

/* Theme switch: a small dropdown in the top-right corner */
.theme-switch {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  font-size: 14px;
  color: var(--ink-soft);
}

.theme-switch select {
  margin-left: 0.25rem;
  padding: 0.15rem 0.25rem;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid var(--outline-soft);
  border-radius: 4px;
}

/* Two themes: "app" is the default, "classic" is the first, sage text page. */
html:not([data-theme="info"]) .theme-info,
html[data-theme="info"] .theme-new {
  display: none;
}

html[data-theme="info"] {
  --bg: #f6f4f0;
  --surface: #ffffff;
  --ink: #2c3330;
  --ink-soft: #6b726d;
  --outline: #8a8d88;
  --outline-soft: #ddd8d0;
  --primary: #4c6e5d;
  color-scheme: light;
}

html[data-theme="info"] body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

html[data-theme="info"] main {
  max-width: 640px;
  padding: 2rem 1.25rem 3rem;
}

html[data-theme="info"] h2 {
  font-size: 1.1rem;
}

html[data-theme="info"] nav {
  font-size: 0.95rem;
}

html[data-theme="info"] footer {
  font-size: 0.9rem;
}

.tagline {
  color: var(--ink-soft);
  margin-bottom: 1.5rem;
}

/* More room between the Join button and the checklist */
.landing #beta {
  margin-bottom: 6rem;
}

/* The title alone is set in Outfit */
.landing h1 {
  font-family: Outfit, Figtree, system-ui, sans-serif;
}

/* The Join button: navy, and a smooth mint fill on hover */
button {
  transition: background-color 0.3s ease, color 0.3s ease;
}

button:hover:not(:disabled) {
  background-color: var(--cta-hover, var(--accent));
  color: var(--cta-hover-ink, var(--navy));
}

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

.theme-switch select:hover {
  border-color: var(--outline);
}

@media (prefers-reduced-motion: reduce) {
  button {
    transition: none;
  }
}

/* Footer links: bolder on hover */
.landing footer a {
  transition: font-weight 0.2s ease;
}

.landing footer a:hover,
.landing footer a:focus-visible {
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .landing footer a {
    transition: none;
  }
}

/* Reserve the bold width, so the links never change size on hover */
.landing footer a {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}

.landing footer a::after {
  content: attr(data-text);
  font-weight: 600;
  height: 0;
  overflow: hidden;
  visibility: hidden;
}

/* Footer links: no underline until hover, then a green one */
.landing footer a {
  text-decoration: none;
}

.landing footer a:hover,
.landing footer a:focus-visible {
  text-decoration: underline;
  text-decoration-color: var(--underline, var(--success));
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

/* The email box gets a mint stroke on hover */
form input[type="email"] {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

form input[type="email"]:hover:not(:focus) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  form input[type="email"] {
    transition: none;
  }
}

/* Privacy policy page: the same link hover as the landing footer (New theme only) */
html:not([data-theme="info"]) main:not(.landing) :is(nav, footer) a {
  text-decoration: none;
  transition: font-weight 0.2s ease;
}

html:not([data-theme="info"]) main:not(.landing) :is(nav, footer) a:hover,
html:not([data-theme="info"]) main:not(.landing) :is(nav, footer) a:focus-visible {
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--underline, var(--success));
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

html:not([data-theme="info"]) main:not(.landing) p a {
  transition: text-decoration-color 0.2s ease;
}

html:not([data-theme="info"]) main:not(.landing) p a:hover {
  text-decoration-color: var(--underline, var(--success));
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  html:not([data-theme="info"]) main:not(.landing) :is(nav, footer) a,
  html:not([data-theme="info"]) main:not(.landing) p a {
    transition: none;
  }
}

/* A dot between the two footer links */
.landing footer {
  position: relative;
}

.landing footer::after {
  content: "\00b7";
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--ink-soft);
}

/* Mint theme, like the app: the Navy page with primary and accent swapped.
   Light mode only; in dark mode
   the Navy look already has a mint accent. */
@media (prefers-color-scheme: light) {
  html[data-theme="mint"] {
    --primary: var(--mint);
    --on-primary: var(--navy);
    --cta-hover: var(--navy);
    --cta-hover-ink: var(--white);
  }

  html[data-theme="mint"] a {
    color: var(--navy);
  }
}

/* Rossa theme, like the app: red leads, navy is the second color (light mode only) */
@media (prefers-color-scheme: light) {
  html[data-theme="rossa"] {
    --primary: var(--red);
    --on-primary: var(--white);
    --cta-hover: var(--navy);
    --cta-hover-ink: var(--white);
    --underline: var(--red);
    --accent: var(--red);
  }

  html[data-theme="rossa"] a {
    color: var(--navy);
  }
}

/* Phone: the Theme dropdown goes away (except in Classic, which has no logo);
   the logo opens the theme list instead. */
.logo {
  -webkit-tap-highlight-color: transparent;
}

.theme-menu:not([hidden]) {
  display: flex;
}

.theme-menu {
  position: absolute;
  top: 7.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  flex-direction: column;
  min-width: 11rem;
  padding: 0.375rem;
  background: var(--surface);
  border: 1px solid var(--outline-soft);
  border-radius: 16px;
  box-shadow: 0 8px 24px var(--shadow);
}

.landing header {
  position: relative;
}

.theme-menu button.theme-option,
.theme-menu button.theme-option:hover:not(:disabled) {
  grid-column: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.7rem 1rem;
  font: inherit;
  font-size: 17px;
  font-weight: 400;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  filter: none;
  transform: none;
  box-shadow: none;
}

.theme-menu button.theme-option:hover:not(:disabled),
.theme-menu button.theme-option:focus-visible {
  background: var(--outline-soft);
  color: var(--ink);
}

.theme-menu button.theme-option[aria-checked="true"] {
  font-weight: 600;
}

.theme-menu button.theme-option[aria-checked="true"]::after {
  content: "\2713";
  color: var(--success);
}

@media (max-width: 600px) {
  html:not([data-theme="info"]) .theme-switch {
    display: none;
  }

  .logo[role="button"] {
    cursor: pointer;
  }
}

/* Classic theme, like the app's Sage theme: the landing page in sage on cream
   (light mode only). */
@media (prefers-color-scheme: light) {
  html[data-theme="classic"] {
    --bg: #f6f3ec;
    --surface: #fdfbf6;
    --ink: #23291f;
    --ink-soft: #4a4e44;
    --outline: #7d8276;
    --outline-soft: #cbc8bc;
    --primary: #4c6e5d;
    --on-primary: #ffffff;
    --error: #b3261e;
    --success: #4c6e5d;
    --accent: #7a9e9f;
    --cta-hover-ink: #23291f;
    --shadow: color-mix(in srgb, #4c6e5d 22%, transparent);
  }
}
