/* Sign In, and the privacy policy. Contract: specs/002-pages-ui-refresh/contracts/pages.md, and
   for the list of apps specs/003-return-after-sign-out/contracts/pages.md.
   This file stands alone: the sign-in page no longer shares the accounts page's stylesheet.
   One narrow card on a plain page; light or dark by the person's own system, and dark is black. */

:root {
  --bg: #faf6f3; --card: #fff; --ink: #2e2522; --muted: #8c7d77; --label: #5a4a44;
  --line: #ece2dc; --input: #fff; --input-line: #e0d3cc; --placeholder: #b3a59f;
  --primary: #4a3832; --on-primary: #fff; --link: #7a5548; --ring: rgba(218, 199, 192, 0.55);
  --hover: #fbf7f5; --error: #b3261e; --shadow: 0 8px 30px rgba(74, 56, 50, 0.06);
  --brand: var(--brand-color, #dac7c0);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000; --card: #0e0e0e; --ink: #f4f1ef; --muted: #9a918d; --label: #c9c0bb;
    --line: #222; --input: #141414; --input-line: #2e2e2e; --placeholder: #6d6662;
    --primary: #dac7c0; --on-primary: #2e2522; --link: #dac7c0; --ring: rgba(218, 199, 192, 0.28);
    --hover: #1a1a1a; --error: #ff8a80; --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { height: 100%; }
body {
  min-height: 100%; margin: 0; padding: 48px 16px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif; font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* The card never grows with the window: 400 px, or the phone's width less its margin. */
.card {
  width: 100%; max-width: 400px;
  padding: 36px 32px 32px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.card.wide { max-width: 560px; }

.brand { margin-bottom: 26px; text-align: center; font: 700 34px/1 'Playfair Display', serif; color: var(--brand); overflow-wrap: anywhere; user-select: none; }
.title { margin: 0 0 28px; text-align: center; font-family: 'Outfit', sans-serif; font-weight: 600; font-size: 32px; line-height: 1.15; letter-spacing: -0.01em; }
.title.small { margin-bottom: 10px; font-size: 24px; }
.lead { margin: -14px 0 24px; text-align: center; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.state .lead { margin: 0; font-size: 15px; line-height: 1.55; }
.lead.first { margin-top: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ─── Fields ─── */
.field { display: block; margin-bottom: 16px; }
.field span { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--label); }
.field input {
  width: 100%; height: 46px; padding: 0 14px;
  border: 1px solid var(--input-line); border-radius: 10px; background: var(--input);
  font: inherit; color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.field input::placeholder { color: var(--placeholder); }
.field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
/* The emailed code: one box per digit, six in a row across the card's width. */
.code-boxes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 20px; }
.code-box {
  width: 100%; min-width: 0; height: 54px; padding: 0;
  border: 1px solid var(--input-line); border-radius: 10px; background: var(--input);
  font: 600 22px/1 var(--mono); color: var(--ink); text-align: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.code-box:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }

.form-error { margin: 0 0 16px; font-size: 14px; color: var(--error); }
.row-end { display: flex; justify-content: flex-end; margin: -4px 0 24px; }

/* ─── Buttons and links ─── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; height: 48px; padding: 0 16px;
  border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer;
  transition: filter 0.2s ease, background 0.2s ease;
}
.btn + .btn { margin-top: 14px; }
.btn-primary { border: none; background: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-outline { border: 1px solid var(--input-line); background: var(--input); color: var(--ink); font-weight: 500; }
.btn-outline:hover:not(:disabled) { background: var(--hover); }
.btn-outline svg { flex: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.loading { cursor: wait; }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.state .btn { margin-top: 24px; }

.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.link {
  padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 500; color: var(--link);
  text-decoration: underline; text-underline-offset: 3px;
}
.link:hover:not(:disabled) { color: var(--ink); }
.link:disabled { color: var(--muted); text-decoration: none; cursor: default; }
.link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 2px; }
/* The line under a form that leads to another screen. */
.alt { margin: 22px 0 0; text-align: center; font-size: 14px; color: var(--muted); }
.alt + .alt { margin-top: 10px; }

/* ─── Screens with nothing to fill in ─── */
.state { text-align: center; }
/* Who is signed in, and the way out - at the foot of the card, since the page has no header. */
.foot { margin: 26px 0 0; padding-top: 18px; border-top: 1px solid var(--line); text-align: center; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.foot .link { font-size: 13px; }

/* The apps a person may open, on the two screens that list them: outlined, like the second
   button of the sign-in form, so each is easy to press on a phone. */
.tools-line { margin: 22px 0 10px; font-size: 13px; font-weight: 500; color: var(--label); }
.tools { list-style: none; margin: 0; padding: 0; }
.tools li + li { margin-top: 10px; }
.tools a {
  display: flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 8px 16px;
  border: 1px solid var(--input-line); border-radius: 10px; background: var(--input);
  color: var(--ink); font-weight: 500; text-decoration: none; overflow-wrap: anywhere;
  transition: background 0.2s ease;
}
.tools a:hover { background: var(--hover); }
.tools a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ─── The full stop of the name while the page loads (Mustafa, 2026-10-20) ───
   The dot is a circle where Playfair's full stop sits (measured at 34px: ink 7px wide, centre 4.5px
   past the word and 2px above the baseline). Its path starts and ends there, so a dot that is not
   moving is the full stop. While viewLoading shows, it leaves, goes under and around the word,
   comes back and hops twice; then again. It starts only after 300 ms, so a page that knows at once
   never shows it; signin.js keeps it at least 500 ms once it has started (sites.md, Screens).
   The path below is the one for "Pepla."; brand-word.js redraws it for the width of any other
   name. A name with no full stop is drawn whole, and its dot shows only while it moves. */
.brand-word { position: relative; display: inline-block; padding-right: 9px; }
.brand-text { display: inline-block; }
.brand-dot {
  position: absolute; left: 0; top: 0; width: 7px; height: 7px;
  offset-path: path("M 85.5,29 Q 95,47 75,47 L -1,47 Q -19,47 -17,25 Q -15,-9 40,-11 Q 95,-11 85.5,29");
  offset-rotate: 0deg;
}
.brand-dot::before { content: ""; display: block; width: 100%; height: 100%; border-radius: 50%; background: currentColor; transform-origin: 50% 100%; }
.card:has(#viewLoading:not([hidden])) .brand-dot { animation: dot-round 2.8s ease-in-out 0.3s infinite; }
.card:has(#viewLoading:not([hidden])) .brand-dot::before { animation: dot-hops 2.8s 0.3s infinite; }
.brand-word.no-stop { padding-right: 0; }
.brand-word.no-stop .brand-dot { visibility: hidden; }
.card:has(#viewLoading:not([hidden])) .brand-word.no-stop .brand-dot { animation: dot-round 2.8s ease-in-out 0.3s infinite, dot-shown 2.8s 0.3s infinite; }
@keyframes dot-shown { from, to { visibility: visible; } }
@keyframes dot-round { 0% { offset-distance: 0%; } 62%, 100% { offset-distance: 100%; } }
@keyframes dot-hops {
  0%, 64% { transform: translateY(0) scale(1, 1); animation-timing-function: ease-out; }
  71% { transform: translateY(-14px) scale(0.9, 1.1); animation-timing-function: ease-in; }
  78% { transform: translateY(0) scale(1.4, 0.65); animation-timing-function: ease-out; }
  84% { transform: translateY(-6px) scale(1, 1); animation-timing-function: ease-in; }
  90% { transform: translateY(0) scale(1.2, 0.8); }
  95%, 100% { transform: translateY(0) scale(1, 1); }
}
@media (prefers-reduced-motion: reduce) {
  .card:has(#viewLoading:not([hidden])) .brand-dot { animation: none; }
  .card:has(#viewLoading:not([hidden])) .brand-dot::before { animation: dot-pulse 1.4s ease-in-out 0.3s infinite; }
}
@keyframes dot-pulse { 50% { opacity: 0.35; } }

/* ─── A page of reading, not a form: the privacy policy ─── */
.prose { font-size: 14px; line-height: 1.6; }
.prose h2 { margin: 24px 0 8px; font-size: 14px; font-weight: 600; }
.prose p { margin: 0 0 12px; }
.prose ul { margin: 0 0 12px; padding-left: 20px; }
.prose li { margin-bottom: 6px; }
.prose a { color: var(--link); text-underline-offset: 3px; overflow-wrap: anywhere; }
.prose code { font-family: var(--mono); font-size: 13px; }

@media (max-width: 480px) {
  body { padding: 24px 12px; align-items: flex-start; }
  .card { padding: 28px 20px 24px; }
  .title { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
