/* Styles for every public HTML page this API serves: the Devise auth pages
   (password reset, email confirmation) and the privacy policy.

   Served from public/ because this app is api_only and has no asset
   pipeline. The filename carries no fingerprint and production sets a
   one-year cache-control on public files, so the layouts append a digest
   query string — see config/initializers/stylesheet_version.rb.

   Page-specific rules are scoped by a body class: .auth is a narrow centred
   card, .legal is a wide left-aligned document. */

/* ============ Fonts ============
   Self-hosted rather than loaded from Google. A stylesheet link to
   fonts.googleapis.com makes every visitor's browser contact Google and
   hand over their IP address — which a privacy policy page should not do
   without naming Google as a recipient. Serving the files ourselves removes
   the third-party request entirely.

   Both families are variable, so one file covers weights 400-600. Only the
   latin and latin-ext subsets are shipped; Japanese text has no glyphs in
   either family and falls back to the system font, as it did before.

   DM Sans and Fraunces are licensed under the SIL Open Font License 1.1,
   which permits redistribution. See public/fonts/OFL.txt. */

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url(/fonts/dm-sans-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url(/fonts/dm-sans-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url(/fonts/fraunces-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url(/fonts/fraunces-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ============ Shared ============
   Mist palette — mirrors pleno-mobile/src/lib/theme.ts. Light only, as the
   app's palette has no dark variants. Text uses the palette's darker tokens:
   inkSoft (3.75:1) and blue (3.16:1) are below WCAG AA at these sizes, while
   ink (11.8:1) and blueDeep (4.96:1) pass. --error is the one value not in
   the palette; blushDeep is 2.61:1. */
:root {
  --canvas: #FBF8F7;
  --paper: #FFFFFF;
  --stone: #E5E6E8;
  --ink: #2F3440;
  --ink-mute: #6B7280;
  --blue-deep: #4A7497;
  --error: #85604F;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

main { margin: 0 auto; }

a { color: var(--blue-deep); }
strong { font-weight: 600; }

/* ============ Auth pages ============ */

body.auth {
  padding: 48px 28px;
  font: 15px/1.6 var(--body);
}

body.auth main { max-width: 26rem; }

body.auth h1 {
  font: 600 32px/1.2 var(--display);
  letter-spacing: -0.5px;
  text-align: center;
  margin: 0;
}

body.auth .lede {
  font: 400 16px/1.5 var(--display);
  color: var(--ink);
  text-align: center;
  margin: 8px 0 40px;
}

body.auth label {
  display: block;
  font: 500 13px/1.4 var(--body);
  color: var(--ink);
  margin: 14px 0 2px;
}

/* Both types: the toggle flips an input to text, and it must keep its look. */
body.auth input[type="password"],
body.auth input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--stone);
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.4 var(--body);
}

body.auth input[type="password"]:focus,
body.auth input[type="text"]:focus {
  outline: none;
  border-color: var(--blue-deep);
}

body.auth button[type="submit"],
body.auth input[type="submit"] {
  width: 100%;
  margin-top: 28px;
  padding: 16px;
  border: 0;
  border-radius: 16px;
  background: var(--blue-deep);
  color: var(--paper);
  font: 600 15px/1.2 var(--body);
  cursor: pointer;
}

/* Password field with its show/hide toggle sitting inside the input. */
body.auth .field { position: relative; }
body.auth .field input[type="password"],
body.auth .field input[type="text"] { padding-right: 52px; }

body.auth .toggle {
  position: absolute;
  top: 0;
  right: 4px;
  height: 100%;
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
}

body.auth .toggle:focus-visible {
  outline: 2px solid var(--blue-deep);
  outline-offset: -2px;
  border-radius: 12px;
}

body.auth .toggle [hidden] { display: none; }

body.auth .errors {
  margin: 0 0 8px;
  font: 400 13px/1.5 var(--body);
  color: var(--error);
  text-align: center;
}

body.auth .errors ul { margin: 0; padding: 0; list-style: none; }

/* ============ Legal pages ============ */

body.legal {
  padding: 48px 20px 96px;
  font: 16px/1.7 var(--body);
}

body.legal main { max-width: 44rem; }

body.legal h1 {
  font: 600 34px/1.2 var(--display);
  letter-spacing: -0.5px;
  margin: 0 0 4px;
}

body.legal h2 {
  font: 600 22px/1.3 var(--display);
  margin: 44px 0 12px;
  padding-top: 20px;
  border-top: 1px solid var(--stone);
}

body.legal h3 { font: 600 17px/1.4 var(--body); margin: 28px 0 8px; }

body.legal p,
body.legal li { font: 400 16px/1.7 var(--body); }

body.legal ul { padding-left: 22px; }
body.legal li { margin: 6px 0; }

body.legal .lede { font: 400 17px/1.6 var(--display); margin: 0 0 8px; }

body.legal .updated {
  color: var(--ink-mute);
  font-size: 14px;
  margin: 0 0 32px;
}

body.legal .langs {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0 0 28px;
  font-size: 14px;
}

body.legal .langs [aria-current] { color: var(--ink); font-weight: 600; }

body.legal .table-wrap { overflow-x: auto; }

body.legal table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  background: var(--paper);
  border: 1px solid var(--stone);
}

body.legal th,
body.legal td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--stone);
  font-size: 15px;
  vertical-align: top;
}

body.legal th { font-weight: 600; }
body.legal tr:last-child td { border-bottom: 0; }

body.legal .callout {
  background: var(--paper);
  border: 1px solid var(--stone);
  border-radius: 14px;
  padding: 18px 20px;
  margin: 20px 0;
}

body.legal .callout p:first-child { margin-top: 0; }
body.legal .callout p:last-child { margin-bottom: 0; }

body.legal footer {
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--stone);
  color: var(--ink-mute);
  font-size: 14px;
}
