/*
 * alfie.family. One stylesheet for every page.
 *
 * The palette is the app's palette: the values come from
 * apps/app/src/theme/tokens.ts, which in turn comes from docs/design-v0.1.html,
 * so the marketing site and the product read as the same thing.
 */

:root {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-2: #edf2f0;
  --ink: #17262a;
  --ink-2: #4a5b60;
  --ink-3: #7b8b90;
  --line: #d3dcd9;
  --line-strong: #a9b8b3;
  --accent: #1e6b67;
  --accent-ink: #ffffff;
  --accent-soft: #dceeec;
  --child: #8a5a14;
  --child-soft: #f5e8cf;
  --shadow: 0 20px 44px -30px rgba(23, 38, 42, 0.55);
  --shadow-soft: 0 10px 24px -22px rgba(23, 38, 42, 0.6);

  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
    sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

  --wrap: 1120px;
  --gutter: 24px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101a1c;
    --surface: #162326;
    --surface-2: #1d2c30;
    --ink: #e4ecea;
    --ink-2: #aebdba;
    --ink-3: #7e9190;
    --line: #2c3d41;
    --line-strong: #46595e;
    --accent: #5fbdb6;
    --accent-ink: #0f1a1b;
    --accent-soft: #1b3a39;
    --child: #e0b466;
    --child-soft: #3a2e15;
    --shadow: 0 20px 44px -28px rgba(0, 0, 0, 0.75);
    --shadow-soft: 0 10px 24px -20px rgba(0, 0, 0, 0.8);
  }
}

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

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

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

a:hover {
  text-decoration-thickness: 2px;
}

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

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.018em;
  font-weight: 600;
  text-wrap: balance;
  /* German compounds are long enough to push a heading out of its card. */
  overflow-wrap: break-word;
}

/*
 * Japanese has no spaces, so a heading may break in the middle of a word.
 * Browsers that know this value break by phrase instead; the rest ignore it.
 */
:lang(ja) h1,
:lang(ja) h2,
:lang(ja) h3 {
  word-break: auto-phrase;
}

p {
  margin: 0;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.prose-wrap {
  max-width: 780px;
}

.eyebrow {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 0 0 8px 0;
  z-index: 10;
}

.skip-link:focus {
  left: 0;
}

/* ---------------------------------------------------------------- nav ---- */

.nav {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.nav__inner {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 62px;
  flex-wrap: wrap;
  padding-top: 8px;
  padding-bottom: 8px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}

.wordmark .mark {
  width: 26px;
  height: 26px;
  flex: none;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 15px;
}

.nav__links a {
  color: var(--ink-2);
  text-decoration: none;
  /* Each item wraps as a whole; "How it works" must not break in two. */
  white-space: nowrap;
}

.nav__links a:hover {
  color: var(--accent);
}

.nav__links a.nav__signin {
  color: var(--accent);
  font-weight: 600;
}

/* Six languages, each written in itself. There is no automatic redirect, so
   this is the only way from one language version to another. */
.nav__langs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
  font-size: 13.5px;
}

.nav__langs a {
  color: var(--ink-3);
  text-decoration: none;
  white-space: nowrap;
}

.nav__langs a:hover {
  color: var(--accent);
}

.nav__langs a[aria-current='page'] {
  color: var(--ink);
  font-weight: 600;
}

@media (max-width: 860px) {
  /* Three rows of header is too much to keep on screen while reading. */
  .nav {
    position: static;
  }

  .nav__langs {
    width: 100%;
    padding-left: 0;
    border-left: 0;
    padding-bottom: 4px;
  }
}

@media (max-width: 560px) {
  .nav__inner {
    gap: 10px;
  }

  .wordmark {
    margin-right: auto;
  }

  .nav__links {
    gap: 8px 16px;
    flex-wrap: wrap;
    font-size: 14px;
    width: 100%;
    padding-bottom: 4px;
  }

  .nav__langs {
    font-size: 13px;
    padding-bottom: 2px;
  }
}

/* -------------------------------------------------------------- pieces ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn--primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, var(--ink));
}

.btn--ghost {
  border-color: var(--line-strong);
  color: var(--ink);
  background: transparent;
}

.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.section {
  padding: 76px 0;
  border-top: 1px solid var(--line);
}

.section__head {
  max-width: 62ch;
  margin-bottom: 44px;
}

.section__head h2 {
  font-size: clamp(26px, 1.2rem + 1.6vw, 34px);
}

.section__head p {
  margin-top: 14px;
  color: var(--ink-2);
}

/* --------------------------------------------------------------- hero ---- */

.hero {
  /* `.hero` sits on the same element as `.wrap`, so only the block padding may
     be set here: a shorthand would drop the gutter and put text on the edge. */
  padding-block: 72px 8px;
}

.hero h1 {
  font-size: clamp(34px, 1.7rem + 3.1vw, 56px);
  max-width: 17ch;
}

.hero__lede {
  margin-top: 20px;
  max-width: 56ch;
  font-size: clamp(17px, 0.95rem + 0.3vw, 20px);
  color: var(--ink-2);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.hero__note {
  margin-top: 16px;
  font-size: 14px;
  color: var(--ink-3);
}

.hero__figure {
  /* Also a `.wrap`: setting the margin shorthand here would cancel the
     `margin: 0 auto` that centres the column on a wide window. */
  margin-block: 48px 0;
  padding-bottom: 76px;
}

/* ------------------------------------------------------------- frames ---- */

.frame {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.frame__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  height: 38px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.frame__dots {
  display: flex;
  gap: 6px;
  flex: none;
}

.frame__dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line-strong);
  opacity: 0.7;
}

.frame__url {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* -------------------------------------------------------------- cards ---- */

.cards {
  display: grid;
  gap: 22px;
}

@media (min-width: 820px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 26px;
  }
}

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 26px;
}

.card h3 {
  font-size: 21px;
}

.card p {
  margin: 12px 0 24px;
  color: var(--ink-2);
  font-size: 16px;
}

.card > p:last-child {
  margin-bottom: 0;
}

/*
 * The four screenshots are different shapes, so each one sits at the foot of
 * its card: the text above keeps its own height and the cards still line up.
 */
.card__shot {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
}

.card__shot img {
  width: 100%;
  height: auto;
}

/* ------------------------------------------------------- assistant art ---- */

.chats {
  display: grid;
  gap: 20px;
}

@media (min-width: 900px) {
  .chats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
  }
}

.chat {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 20px;
  box-shadow: var(--shadow-soft);
}

.chat__turn {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
}

.chat__turn:last-of-type {
  margin-bottom: 0;
}

.chat__who {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.chat__bubble {
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 15.5px;
  line-height: 1.55;
}

.chat__turn--asked .chat__bubble {
  background: var(--accent-soft);
  color: var(--ink);
  justify-self: start;
  max-width: 90%;
}

.chat__turn--answered .chat__bubble {
  background: var(--surface-2);
  color: var(--ink);
}

.chat__bubble p + p {
  margin-top: 10px;
}

/* -------------------------------------------------------------- steps ---- */

.steps {
  counter-reset: step;
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 820px) {
  .steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 40px;
  }
}

.steps li {
  counter-increment: step;
  padding: 24px 0;
  border-top: 1px solid var(--line);
}

@media (min-width: 820px) {
  .steps li {
    padding: 26px 0 0;
  }
}

.steps li::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  margin-bottom: 10px;
}

.steps h3 {
  font-size: 19px;
}

.steps p {
  margin-top: 10px;
  color: var(--ink-2);
  font-size: 16px;
}

/* A step that is one sentence long has no heading above it to sit under. */
.steps--lines p {
  margin-top: 0;
  color: var(--ink);
  font-size: 17px;
}

/* ------------------------------------------------------------ privacy ---- */

/* A reading column, left-aligned with the section heading above it. */
.panel {
  max-width: 780px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 26px;
}

.panel h3 {
  font-size: 18px;
}

.panel ul {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
  color: var(--ink-2);
  font-size: 16px;
}

.panel > ul:first-child {
  margin-top: 0;
}

.panel p {
  margin-top: 18px;
  color: var(--ink-2);
  font-size: 16px;
}

.panel li {
  position: relative;
  padding-left: 22px;
}

.panel li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--accent);
}

/* ---------------------------------------------------------------- faq ---- */

.faq {
  max-width: 780px;
  border-top: 1px solid var(--line);
}

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

.faq summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: '+';
  flex: none;
  font-size: 20px;
  font-weight: 400;
  color: var(--ink-3);
  line-height: 1;
}

.faq details[open] summary::after {
  content: '–';
}

.faq details p {
  padding: 0 0 22px;
  max-width: 74ch;
  color: var(--ink-2);
}

.faq details p + p {
  padding-top: 0;
  margin-top: -8px;
}

/* ------------------------------------------------------------- cta/foot -- */

.cta {
  border-top: 1px solid var(--line);
  padding: 76px 0;
  background: var(--accent-soft);
}

.cta h2 {
  font-size: clamp(26px, 1.2rem + 1.6vw, 34px);
  max-width: 20ch;
}

.cta p {
  margin-top: 14px;
  color: var(--ink-2);
  max-width: 54ch;
}

.cta .btn {
  margin-top: 28px;
}

.foot {
  border-top: 1px solid var(--line);
  padding: 34px 0 48px;
  font-size: 14.5px;
  color: var(--ink-3);
}

.foot__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  align-items: center;
}

.foot a {
  color: var(--ink-2);
  text-decoration: none;
}

.foot a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.foot__sep {
  color: var(--line-strong);
}

/* --------------------------------------------------------------- legal --- */

.doc {
  /* Shares its element with `.wrap`; see the note on `.hero`. */
  padding-block: 56px 80px;
}

.doc h1 {
  font-size: clamp(30px, 1.5rem + 2vw, 42px);
}

.doc__meta {
  margin-top: 14px;
  font-size: 14px;
  color: var(--ink-3);
}

/*
 * Which language version of a legal text governs. The English pages carry no
 * such note, and their copy for it is empty, so the paragraph disappears.
 */
.doc__note {
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-3);
}

.doc__note:empty {
  display: none;
}

.doc h2 {
  margin-top: 44px;
  font-size: 21px;
}

.doc h3 {
  margin-top: 28px;
  font-size: 17px;
}

.doc p,
.doc ul,
.doc ol {
  margin-top: 14px;
  color: var(--ink-2);
  font-size: 16.5px;
}

.doc ul,
.doc ol {
  padding-left: 22px;
}

.doc li + li {
  margin-top: 8px;
}

.doc__toc {
  margin-top: 34px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.doc__toc p {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* The headings carry their own numbers, so the list must not add a second. */
.doc__toc ol {
  margin: 0;
  padding-left: 0;
  list-style: none;
  font-size: 15.5px;
}

.doc__toc a {
  color: var(--ink-2);
  text-decoration: none;
}

.doc__toc a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ----------------------------------------------------------------- 404 --- */

.notfound {
  /* Shares its element with `.wrap`; see the note on `.hero`. */
  padding-block: 110px 130px;
}

.notfound h1 {
  font-size: clamp(30px, 1.5rem + 2vw, 42px);
}

.notfound p {
  margin-top: 16px;
  color: var(--ink-2);
  max-width: 50ch;
}

.notfound .btn {
  margin-top: 28px;
}
