/*
 * MailPush site style: a white page, one accent color, thin lines between sections, the system's
 * own fonts, large touch targets, and a dark mode. Nothing here loads from outside
 * (the page policy allows styles from the site only), so no imports, no web fonts, no images.
 * The page is 60rem (960px) wide; long text keeps a line of about 70 characters (--measure).
 * San Francisco comes first in the font stack on Apple devices, which have it built in: no font
 * file is served, because Apple's license does not allow serving San Francisco to other devices.
 *
 * Colors: every color is a variable, declared in four places and nowhere else. The light values are
 * on :root. The dark values are under prefers-color-scheme (Auto, the default: the page follows the
 * device and switches when the device does) unless Light was chosen, and again under data-theme="dark"
 * (Dark was chosen). The server puts data-theme on the html element from the person's cookie, so the
 * first paint is in the right theme; Auto puts nothing. Print always uses the light values, so a dark
 * page does not print pale text on white paper. tests/php/ThemeCssTest.php holds all four places to the
 * same list, forbids a color anywhere else, and checks WCAG AA contrast for each pair in both themes.
 */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #16181d;
  --muted: #5a606b;
  --line: #e3e5e9;
  --line-strong: #b9bec7;
  --field-line: #7d8591;
  --accent: #0b5fd6;
  --accent-fg: #ffffff;
  --accent-soft: #eaf2ff;
  --problem: #b42318;
  --page: 60rem;
  --measure: 44rem;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-theme="light"] { color-scheme: light; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1114;
    --fg: #eceef2;
    --muted: #a3a9b4;
    --line: #2a2e35;
    --line-strong: #4a505b;
    --field-line: #6b7280;
    --accent: #7db0ff;
    --accent-fg: #08111f;
    --accent-soft: #16233a;
    --problem: #ff8a7d;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1114;
  --fg: #eceef2;
  --muted: #a3a9b4;
  --line: #2a2e35;
  --line-strong: #4a505b;
  --field-line: #6b7280;
  --accent: #7db0ff;
  --accent-fg: #08111f;
  --accent-soft: #16233a;
  --problem: #ff8a7d;
}

@media print {
  :root:not([data-theme="light"]), :root[data-theme="dark"] {
    color-scheme: light;
    --bg: #ffffff;
    --fg: #16181d;
    --muted: #5a606b;
    --line: #e3e5e9;
    --line-strong: #b9bec7;
    --field-line: #7d8591;
    --accent: #0b5fd6;
    --accent-fg: #ffffff;
    --accent-soft: #eaf2ff;
    --problem: #b42318;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1.0625rem/1.6 var(--font);
}

.wrap {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 16px;
}

/* Skip link: visible only while it has the keyboard focus. */
.skip {
  position: absolute;
  left: 8px;
  top: -4rem;
  padding: 10px 14px;
  background: var(--bg);
  color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 8px;
  z-index: 10;
}
.skip:focus { top: 8px; }

/* Header and footer */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 24px;
  padding-top: 12px;
  padding-bottom: 12px;
}
.brand {
  color: var(--fg);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
}
.site-header nav { display: flex; flex-wrap: wrap; gap: 0 18px; }
.site-header nav a {
  display: inline-block;
  padding: 10px 0;
  color: var(--muted);
  text-decoration: none;
}
.site-header nav a:hover { color: var(--accent); }
.site-header nav a[aria-current="page"] {
  color: var(--fg);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.site-footer {
  margin-top: 48px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9375rem;
}
.site-footer .wrap { padding-top: 20px; padding-bottom: 40px; }
.site-footer p { margin: 0 0 10px; }
.site-footer .links a { display: inline-block; margin: 0 16px 6px 0; padding: 4px 0; }
.site-footer .small { font-size: 0.8125rem; }

/* Page body: one column, sections divided by a thin line. */
main {
  display: block;
  max-width: var(--page);
  margin: 0 auto;
  padding: 8px 16px 0;
}
main > section { border-top: 1px solid var(--line); padding: 28px 0; }
main > section:first-child { border-top: 0; }
main > .hero { padding-top: 40px; }

/* Long text keeps a readable line on a wide page; the steps and the drawings use the whole page. */
main p, main li, main dd, main dt, main h1, main h2, main h3 { max-width: var(--measure); }
.notice, dl.values { max-width: var(--measure); }
main form { max-width: 36rem; }
ol.steps > li { max-width: none; }

h1, h2, h3 { line-height: 1.25; font-weight: 700; margin: 0 0 12px; }
h1 { font-size: clamp(1.9rem, 6vw, 2.5rem); letter-spacing: -0.01em; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; margin-top: 24px; }
p, ul, ol, dl { margin: 0 0 16px; }
ul, ol { padding-left: 1.4em; }
li { margin-bottom: 6px; }
strong { font-weight: 650; }
.tagline { font-size: 1.25rem; color: var(--muted); margin-bottom: 20px; }
.lead { font-size: 1.1875rem; }
.small, .hint { color: var(--muted); font-size: 0.9375rem; }

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

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

code, kbd {
  font-family: var(--mono);
  font-size: 0.95em;
  padding: 0.1em 0.35em;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--accent-soft);
  overflow-wrap: anywhere;
}

/* Buttons: links and real buttons look the same and say exactly what they do. */
.button, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-fg);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.button:hover, button:hover { filter: brightness(1.08); text-decoration: none; }
/* A button of a form that was sent is locked (site.js) until the page changes: it looks locked and does not brighten. */
button:disabled { opacity: 0.6; cursor: default; filter: none; }
.button.secondary, button.secondary { background: transparent; color: var(--accent); }
.button.danger, button.danger { background: transparent; color: var(--problem); border-color: var(--problem); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0 8px; }

/* Forms */
label { display: block; margin: 18px 0 6px; font-weight: 600; }
input[type="text"], input[type="email"], input[type="password"], textarea, select {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--field-line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}
textarea { min-height: 7rem; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 18px 0; font-weight: 400; }
.check input { flex: none; width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--accent); }
form .actions { margin-top: 22px; }
/* The trap field of the request form: out of sight for people, in the page for scripts. */
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Notices */
.notice {
  margin: 0 0 20px;
  padding: 14px 16px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent-soft);
}
.notice.problem { border-color: var(--problem); background: transparent; }
.notice p:last-child { margin-bottom: 0; }

/* Home page benefits */
.benefits { list-style: none; padding: 0; }
.benefits li { padding: 12px 0; border-top: 1px solid var(--line); margin: 0; }
.benefits li:first-child { border-top: 0; }
.benefits strong { display: block; }
.benefits strong::first-letter { text-transform: uppercase; }

/* Questions: a heading, then its answer, each in its own thin ruled block. */
main > section.qa { padding: 20px 0; }
.qa h2 { font-size: 1.15rem; margin-bottom: 8px; }
.qa p:last-child, .qa ul:last-child { margin-bottom: 0; }

/* Narrow phones: the page already has a 16px gutter; make the actions fill the width. */
@media (max-width: 30rem) {
  .actions .button, .actions button { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: no-preference) {
  .button, button { transition: filter 0.12s ease; }
}

@media print {
  .site-header nav, .skip, .theme { display: none; }
}

/* How to connect: the steps, and the line drawings of the iPhone and iPad screens. */
dl.values { margin: 0 0 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--accent-soft); }
dl.values dt { margin-top: 10px; font-weight: 650; }
dl.values dt:first-child { margin-top: 0; }
dl.values dd { margin: 2px 0 0; }

ol.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; }
ol.steps > li { counter-increment: step; position: relative; margin: 0; padding: 22px 0 22px 52px; border-top: 1px solid var(--line); }
ol.steps > li:first-child { border-top: 0; padding-top: 4px; }
ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 22px;
  width: 36px;
  height: 36px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-weight: 700;
  line-height: 32px;
  text-align: center;
}
ol.steps > li:first-child::before { top: 4px; }
ol.steps h3 { margin: 4px 0 8px; }

.shots { display: flex; flex-wrap: wrap; gap: 16px 20px; align-items: flex-start; margin: 14px 0 4px; }
.shots figure { margin: 0; max-width: 100%; }
.shots figcaption { margin-top: 6px; color: var(--muted); font-size: 0.875rem; }

svg.draw { display: block; max-width: 100%; height: auto; }
.draw .ln { fill: none; stroke: var(--fg); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.draw .soft { fill: none; stroke: var(--line-strong); stroke-width: 1; stroke-linecap: round; }
.draw .ck { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.draw .on { fill: var(--accent); stroke: var(--accent); }
.draw .knob { fill: var(--bg); stroke: var(--fg); stroke-width: 1.3; }
.draw .knob.on { stroke: var(--accent); }
.draw .hi { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.5; }
.draw .fill { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 4 3; }
.draw .ring { fill: var(--accent); fill-opacity: 0.2; stroke: var(--accent); stroke-width: 1.5; }
.draw .dot { fill: var(--accent); }
.draw text { fill: var(--fg); font: 12.5px var(--font); }
.draw .t { fill: var(--fg); }
.draw .tb { font-weight: 650; }
.draw .tm { fill: var(--muted); }
.draw .ta { fill: var(--accent); }
.draw .sm { font-size: 10.5px; }
.draw .xs { font-size: 9.5px; letter-spacing: 0.04em; }

@media (max-width: 30rem) {
  ol.steps > li { padding-left: 0; padding-top: 56px; }
  ol.steps > li:first-child { padding-top: 48px; }
  ol.steps > li::before { top: 14px; }
  ol.steps > li:first-child::before { top: 4px; }
}

/* Onboarding: the phone password, shown once. */
.password { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 8px 0 12px; }
.password code { font-size: 1.35rem; letter-spacing: 0.04em; padding: 0.3em 0.6em; user-select: all; }

/* Account page: the devices, with a table of folders. */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
form.inline { display: inline; margin: 0; }
table.folders { width: 100%; table-layout: fixed; border-collapse: collapse; margin: 8px 0 24px; font-size: 0.9375rem; }
table.folders th:first-child { width: 40%; }
table.folders th:last-child { width: 6.5rem; }
table.folders th, table.folders td { padding: 8px 8px 8px 0; border-top: 1px solid var(--line); text-align: left; vertical-align: middle; overflow-wrap: anywhere; }
table.folders thead th { border-top: 0; color: var(--muted); font-weight: 600; }
table.folders tbody th { font-weight: 500; }
table.folders button { min-height: 36px; padding: 0 14px; }

/* Appearance (the footer): Auto, Light or Dark, a row of three buttons, the current one filled. It is a form that works
   without a script; site.js applies a choice at once. */
form.theme { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0 0 14px; }
.theme-label { color: var(--fg); font-weight: 600; }
.theme-options { display: inline-flex; }
.theme-options button {
  position: relative;
  min-width: 4.5rem;
  padding: 0 16px;
  border-radius: 0;
  border-color: var(--field-line);
  background: transparent;
  color: var(--fg);
}
.theme-options button + button { margin-left: -1px; }
.theme-options button:first-child { border-radius: 10px 0 0 10px; }
.theme-options button:last-child { border-radius: 0 10px 10px 0; }
.theme-options button:hover { background: var(--accent-soft); filter: none; }
.theme-options button[aria-pressed="true"],
.theme-options button[aria-pressed="true"]:hover { z-index: 1; border-color: var(--accent); background: var(--accent); color: var(--accent-fg); }
.theme-options button:focus-visible { z-index: 2; }
.theme-help { flex: 1 0 100%; font-size: 0.8125rem; }
form.theme [hidden] { display: none; }
/* Where the system forces its own colors (Windows high contrast) a filled button is not filled: a check mark shows the current choice. */
@media (forced-colors: active) { .theme-options button[aria-pressed="true"]::before { content: "\2713\00a0"; } }
