/* The pages in front of the app (PLAN.md Stages 14, 15 and 17): the sign-in
   pages, the contact page, the docs and the legal texts.
   They load the theme tokens (`/theme.css`) and two font parts only: Latin in
   the book serif and in Inter. The landing page adds `landing.css`. */

@font-face {
  font-family: "NewCM"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("/fonts/NewCM10-Book.latin.woff2?v=8") format("woff2");
  unicode-range: U+0020-007E, U+00A0-00FF, U+2010-2014, U+2018-2022, U+2026;
}

@font-face {
  font-family: "Inter"; font-weight: 400 700; font-style: normal; font-display: swap;
  src: url("/fonts/Inter.latin.woff2?v=8") format("woff2");
  unicode-range: U+0020-007E, U+00A0-00FF, U+2010-2014, U+2018-2022, U+2026;
}

:root {
  --serif: "NewCM", Georgia, "Times New Roman", serif;
  /* The app's stack (app/index.html), with Inter first. */
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* The app's dimmed text. theme.css sets only the base; without these two
     lines every `var(--fg-dim)` here falls back to the full ink. */
  --dim-lift: 20%;
  --fg-dim: color-mix(in oklab, var(--fg-dim-base), var(--fg) var(--dim-lift));
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100svh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--fg); font-family: var(--sans); line-height: 1.55;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0)
    env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}
a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--fg); }

/* The head: the mark, the docs and the contact, and the account state. On a
   phone the docs and the contact are in the foot only, so the head fits. */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  width: 100%; max-width: 68rem; margin: 0 auto; padding: 1.1rem 1.5rem;
}
.mark { display: inline-flex; color: var(--fg); flex: none; }
.mark .logo { width: 2.1rem; height: 2.1rem; fill: currentColor; }
.menu { display: flex; align-items: center; gap: 0.6rem 1.25rem; min-width: 0; }
.menu .link { color: var(--fg-muted); text-decoration: none; font-size: 0.95rem; }
.menu .link:hover { color: var(--fg); }
.menu .btn + .btn { margin-left: -0.5rem; }
@media (max-width: 34rem) {
  .top { padding-inline: 1rem; }
  .menu .link { display: none; }
}

/* The account menu of a signed-in visitor: the account button of the app's
   header, and the groups of the app's account popover. It is a `<details>`,
   so it opens with no script; its actions are links and forms. */
.acct { position: relative; flex: none; }
.acct-btn {
  display: grid; place-items: center; width: 2.3rem; height: 2.3rem; list-style: none; cursor: pointer;
  border: 1px solid transparent; border-radius: var(--radius, 0.375rem); color: var(--fg);
}
.acct-btn::-webkit-details-marker { display: none; }
.acct-btn:hover, .acct[open] .acct-btn { border-color: var(--rule); }
.acct-icon { width: 1.35rem; height: 1.35rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.acct-panel {
  position: absolute; right: 0; top: calc(100% + 0.5rem); z-index: 20;
  width: 21rem; max-width: min(24rem, calc(100vw - 1.5rem)); padding: 1rem 1.1rem;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 0.7rem;
  box-shadow: 0 1.25rem 2.5rem rgb(0 0 0 / 0.16); line-height: normal;
}
/* The values of the app's popover (`.panel-group`, `.panel-label`, `.setting`,
   `.link-btn` in app/index.html), so the two menus look the same. */
.acct-group { display: flex; flex-direction: column; }
.acct-group + .acct-group { margin-top: 1rem; }
.acct-group h3 {
  margin: 0 0 0.4rem; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--fg-dim);
}
.acct-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 0;
  padding: 0.75rem 0; border-bottom: 1px solid var(--border); font-size: 1rem;
}
.acct-group .acct-row:last-child { border-bottom: none; padding-bottom: 0.25rem; }
.acct-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-muted); }
.acct-row > .acct-name { color: var(--fg); }
.acct-row a, .acct-row button {
  flex: none; font: inherit; font-size: 0.92rem; color: var(--fg-muted); background: none; border: none;
  padding: 0; cursor: pointer; text-decoration: none;
}
.acct-row a:hover, .acct-row button:hover { color: var(--fg); }
/* The two themes, squared as the app's controls; the one in use is marked. */
.acct-choice { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--radius, 0.375rem); overflow: hidden; }
.acct-choice button { padding: 0.25rem 0.7rem; font-size: 0.88rem; color: var(--fg); }
.acct-choice button + button { border-left: 1px solid var(--rule); }
.acct-choice button:hover { text-decoration: none; background: var(--bg-subtle); }
:root[data-theme="light"] .t-light, :root[data-theme="dark"] .t-dark { background: var(--fg); color: var(--bg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .t-dark { background: var(--fg); color: var(--bg); } }
@media (prefers-color-scheme: light) { :root:not([data-theme]) .t-light { background: var(--fg); color: var(--bg); } }

main { flex: 1; width: 100%; max-width: 68rem; margin: 0 auto; padding: 1rem 1.5rem 4rem; }

/* A form alone on its page: one column, as narrow as an email. */
.form { display: flex; flex-direction: column; gap: 0.85rem; max-width: 24rem; margin: 3rem auto 0; }
.form.wider { max-width: 34rem; }
.sent { font-size: 1.15rem; margin: 0; }
.form h1, .form h2 {
  font-family: var(--serif); font-weight: 400; font-size: 2rem; line-height: 1.2; margin: 0;
}
.form p { margin: 0; color: var(--fg-muted); }
.form label { font-size: 0.95rem; }
textarea.field { resize: vertical; min-height: 9rem; line-height: 1.5; }
.field {
  font: inherit; width: 100%; padding: 0.7rem 0.85rem; border-radius: var(--radius, 0.375rem);
  border: 1px solid var(--rule); background: var(--surface); color: var(--fg);
}
.field:focus { outline: none; border-color: var(--fg-muted); }
.field.code { font-size: 1.4rem; letter-spacing: 0.3em; text-align: center; }
.check { display: flex; gap: 0.6rem; align-items: flex-start; color: var(--fg-muted); }
.check input { margin: 0.3rem 0 0; width: 1.05rem; height: 1.05rem; accent-color: var(--fg); }
/* A button: the main one is ink on paper; `ghost` has a border only. A link
   can be a button too. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; white-space: nowrap;
  font: inherit; padding: 0.7rem 1.2rem; border-radius: var(--radius, 0.375rem); border: 1px solid var(--fg);
  background: var(--fg); color: var(--bg); cursor: pointer; touch-action: manipulation; text-decoration: none;
}
a.btn:hover { color: var(--bg); }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--rule); }
.btn.ghost:hover { color: var(--fg); border-color: var(--fg); }
.btn.small { padding: 0.45rem 0.9rem; font-size: 0.92rem; }
.btn.big { padding: 0.8rem 1.4rem; font-size: 1.05rem; }
@media (max-width: 24rem) { .btn.small { padding-inline: 0.65rem; } }
.error { color: var(--fg); font-size: 0.95rem; padding: 0.6rem 0.8rem; background: var(--bg-subtle); border-radius: var(--radius, 0.375rem); }
.aside { font-size: 0.9rem; }

/* The honeypot: no person sees it, and no screen reader reads it. */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* The docs: the menu on the left, the page on the right. On a phone the
   menu folds above the page. */
.docs { display: grid; gap: 1.5rem; padding-top: 1rem; }
@media (min-width: 52rem) {
  .docs { grid-template-columns: 14rem minmax(0, 1fr); column-gap: 4rem; align-items: start; }
  .toc { position: sticky; top: 1.5rem; }
}
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; }
.toc a {
  display: block; padding: 0.35rem 0.75rem; border-radius: var(--radius, 0.375rem);
  color: var(--fg-muted); text-decoration: none; font-size: 0.95rem;
}
.toc a:hover { color: var(--fg); }
.toc a[aria-current="page"] { color: var(--fg); background: var(--highlight); }
.toc-fold { border: 1px solid var(--border); border-radius: var(--radius, 0.375rem); padding: 0.6rem 0.75rem; }
.toc-fold summary { cursor: pointer; font-size: 0.95rem; }
.toc-fold ol { margin-top: 0.5rem; }
.toc .toc-list { display: none; }
@media (min-width: 52rem) {
  .toc .toc-fold { display: none; }
  .toc .toc-list { display: grid; }
}
.doc { max-width: 44rem; min-width: 0; }
.doc h1 { font-family: var(--serif); font-weight: 400; font-size: 2.4rem; line-height: 1.15; margin: 0 0 1.5rem; }
.doc h2 { font-family: var(--serif); font-weight: 400; font-size: 1.55rem; margin: 2.5rem 0 0.75rem; }
.doc h3 { font-size: 1.05rem; margin: 1.75rem 0 0.5rem; }
.doc p, .doc li { line-height: 1.65; }
.doc ul, .doc ol { padding-left: 1.4rem; }
.doc code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.88em;
  background: var(--bg-subtle); padding: 0.1em 0.35em; border-radius: 0.25rem;
}
.doc pre {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius, 0.375rem);
  padding: 0.9rem 1rem; overflow-x: auto; line-height: 1.5;
}
.doc pre code { background: none; padding: 0; font-size: 0.85rem; }
.doc table { border-collapse: collapse; display: block; overflow-x: auto; margin: 1rem 0; font-size: 0.95rem; }
.doc th, .doc td { text-align: left; padding: 0.45rem 0.9rem 0.45rem 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.doc th { font-weight: 600; }
.doc td code { white-space: nowrap; }

/* A legal text. */
.legal { max-width: 42rem; margin: 0 auto; }
.legal h1 { font-family: var(--serif); font-weight: 400; font-size: 2.2rem; margin: 1rem 0 0.25rem; }
.legal .date { color: var(--fg-muted); margin: 0 0 2rem; }
.legal h2 { font-family: var(--serif); font-weight: 400; font-size: 1.35rem; margin: 2rem 0 0.5rem; }
.legal h3 { font-size: 1rem; margin: 1.25rem 0 0.25rem; }
.legal p, .legal li { color: var(--fg); }
.legal ul { padding-left: 1.25rem; }
.legal .callout { border-left: 2px solid var(--rule); padding: 0.25rem 0 0.25rem 1rem; color: var(--fg-muted); }

/* The foot: the docs, the contact and the legal texts. */
.foot {
  width: 100%; max-width: 68rem; margin: 0 auto; padding: 1.5rem 1.5rem 2rem;
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem;
  color: var(--fg-muted); font-size: 0.9rem; border-top: 1px solid var(--border);
}
.foot a { color: inherit; text-decoration: none; }
.foot a:hover { color: var(--fg); }
