/* password.parks.cloud: the security envelope (docs/design.md, "Look"). The password on a perforated slip inside a
   crosshatch-tinted envelope; one deep security blue for the actions; digits in blue and symbols in red (D7).
   Layout: one column on a phone; from 860px, the password on the left, the settings on the right, "How this works" below.
   Nothing on the page moves when a setting changes: the password box keeps one size, and every note has its room. */
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("atkinson-hyperlegible-next-var-latin.18b2a1a39a.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Mono";
  src: url("atkinson-hyperlegible-mono-var-latin.2706b1ee4f.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --page: #F5F5F1;
  --slip: #FFFFFF;
  --ink: #15202B;
  --muted: #4E5A66;
  --rule: #D3D9DF;
  --tint: #C2CCD6;
  --perf: #7F8C99;
  --accent: #1C4884;
  --on-accent: #FFFFFF;
  --digit: #1C4884;
  --symbol: #A82115;
  --focus: #15202B;
  --text-face: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono-face: "Atkinson Hyperlegible Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0E141B;
    --slip: #161F29;
    --ink: #E3E9EF;
    --muted: #A1ADB9;
    --rule: #25303C;
    --tint: #233140;
    --perf: #5D6C7C;
    --accent: #93B7EC;
    --on-accent: #0E141B;
    --digit: #93B7EC;
    --symbol: #FF8A7A;
    --focus: #E3E9EF;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--text-face);
  font-size: 1.0625rem;
  line-height: 1.5;
}
a { color: var(--accent); text-underline-offset: .2em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.wrap { max-width: 68rem; margin-inline: auto; padding-inline: 1rem; padding-block: 1.25rem 3rem; }
@media (min-width: 860px) { .wrap { padding-inline: 2rem; padding-block: 2rem 4rem; } }

.back a { display: inline-flex; align-items: center; min-height: 44px; }
h1 { margin: 0; font-size: clamp(2rem, 1.3rem + 2.6vw, 3rem); line-height: 1.08; font-weight: 760; letter-spacing: -.012em; text-wrap: balance; }
.promise { margin: .5rem 0 0; color: var(--muted); max-width: 40rem; }
.promise a { color: var(--muted); }

.needs-js { display: none; }

main { display: grid; gap: 1.5rem; margin-top: 1.75rem; }
@media (min-width: 860px) { main { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 2rem; align-items: start; margin-top: 2.25rem; } }

/* The envelope and the slip. */
.envelope {
  padding: 1rem;
  border: 1px solid var(--rule);
  background-color: var(--page);
  background-image:
    repeating-linear-gradient(45deg, var(--tint) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(-45deg, var(--tint) 0 1px, transparent 1px 7px);
}
.label { display: inline-block; margin: 0 0 .75rem; padding: .125rem .5rem; background: var(--slip); color: var(--ink); font-size: .9375rem; font-weight: 650; }

/* The password box: one size at every length, so nothing below it moves. app.js picks the largest type that fits and
   breaks the password only after a multiple of five characters, each line with its own ruler. */
.pw-box {
  position: relative;
  height: 11.5rem;
  padding: .75rem 1rem;
  display: grid;
  align-content: center;
  overflow: hidden;
  background: var(--slip);
  border-block: 2px dashed var(--perf);
}
@media (min-width: 860px) { .pw-box { height: 10rem; padding-inline: 1.25rem; } }
.pw { font-family: var(--mono-face); font-weight: 520; line-height: 1.2; letter-spacing: .03em; font-size: 28px; min-width: 0; }
.pw-line { display: block; }
.pw-chars { display: block; white-space: pre; }
.pw-ruler {
  display: flex;
  height: calc(.2em + 2px + 1.2 * max(.3em, .75rem));
  margin-bottom: .08em;
  letter-spacing: 0;
  user-select: none;
  -webkit-user-select: none;
}
/* Each cell is one character wide; a mark stacks its tick over its number, centred, the number free to be wider. */
.pw-ruler .cell { flex: 0 0 calc(1ch + .03em); display: flex; flex-direction: column; align-items: center; min-width: 0; }
.pw-ruler .mark::before { content: ""; flex: none; width: 1px; height: .2em; background: var(--perf); }
.pw-ruler .mark i {
  flex: none; margin-top: 2px; white-space: nowrap;
  font-style: normal; font-weight: 400; font-size: max(.3em, .75rem); line-height: 1.2;
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.c.digit, .g.digit { color: var(--digit); }
.c.symbol, .w.symbol { color: var(--symbol); }
/* Measures the mono face's advance, so app.js can tell how many characters fit on a line. */
.probe { position: absolute; left: 0; top: 0; visibility: hidden; white-space: pre; font-family: var(--mono-face); font-size: 100px; letter-spacing: 0; line-height: 1; pointer-events: none; }

.actions { display: flex; flex-wrap: wrap; gap: .625rem; margin-top: 1rem; align-items: center; }
.button {
  font: inherit; font-size: 1rem; font-weight: 650;
  min-height: 44px; padding: 0 1.05rem;
  display: inline-flex; align-items: center;
  border-radius: 3px; border: 2px solid var(--muted); background: var(--slip); color: var(--ink);
  cursor: pointer;
}
.button:hover { border-color: var(--ink); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.button.primary:hover { filter: brightness(1.08); }
/* "Copied." and the copy-failure note: room for three lines on a phone and two on a desktop, always. */
.status { margin: .5rem 0 0; padding: 0 .5rem; min-height: 4.5em; color: var(--ink); background: var(--slip); font-size: .9375rem; line-height: 1.5; }
.status:empty { background: transparent; }

.strength { margin: .5rem 0 0; padding: .5rem .75rem; background: var(--slip); display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: baseline; min-height: 6rem; align-content: start; }
@media (min-width: 860px) { .strength { min-height: 4.75rem; } .status { min-height: 3em; } }
.strength .k { font-weight: 650; }
.strength b { font-family: var(--mono-face); font-size: 1.25rem; font-weight: 700; }
.strength small { color: var(--muted); font-size: .9375rem; }

/* Settings. */
.settings { background: var(--slip); border: 1px solid var(--rule); padding: 1.25rem; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; margin-bottom: .25rem; font-weight: 700; font-size: 1.0625rem; }
.opt { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .75rem; align-items: center; min-height: 44px; cursor: pointer; }
.opt input { width: 1.25rem; height: 1.25rem; margin: 0; accent-color: var(--accent); cursor: pointer; }
.opt .chars { font-family: var(--mono-face); color: var(--muted); font-size: .9375rem; letter-spacing: .04em; }
.opt.lookalike { margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--rule); }
.hint { margin: .25rem 0 0; min-height: 1.5em; color: var(--muted); font-size: .9375rem; }
.length { margin-top: .75rem; }
.length .row { display: flex; justify-content: space-between; align-items: baseline; }
.length label { font-weight: 700; }
.length output { font-family: var(--mono-face); font-size: 1.375rem; font-weight: 700; }
.length input[type="range"] { width: 100%; margin: .25rem 0 0; min-height: 44px; accent-color: var(--accent); cursor: pointer; }
.scale { display: flex; justify-content: space-between; margin: 0; color: var(--muted); font-family: var(--mono-face); font-size: .875rem; }

/* How this works. */
.how { margin-top: 2rem; border-top: 2px dashed var(--perf); padding-top: 1.25rem; }
.how h2 { font-size: 1.125rem; margin: 0 0 .5rem; }
.how .cols { display: grid; gap: 0 2.5rem; }
@media (min-width: 860px) { .how .cols { grid-template-columns: 1fr 1fr; } }
.how p { margin: 0 0 .75rem; max-width: 40rem; }
.how code { font-family: var(--mono-face); font-size: .9375em; }
.how a { white-space: nowrap; } /* keeps "SP 800-63B-4" in one piece */
/* Read by screen readers, never shown: the NIST link's "(opens in a new tab)". */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

footer { margin-top: 2rem; color: var(--muted); font-size: .9375rem; }
footer a { color: var(--muted); }

/* The spelling, over the page: a second slip with the envelope's tint along its top edge. */
dialog.spell {
  width: min(42rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  padding: 0;
  border: 0;
  background: var(--slip);
  color: var(--ink);
}
dialog.spell::backdrop { background: rgb(10 16 22 / .6); }
.sheet { padding: 0 1.25rem 1rem; }
.sheet::before {
  content: ""; display: block; height: 1rem; margin: 0 -1.25rem 1rem;
  border-bottom: 2px dashed var(--perf);
  background-image:
    repeating-linear-gradient(45deg, var(--tint) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(-45deg, var(--tint) 0 1px, transparent 1px 7px);
}
.sheet-head { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.sheet h2 { margin: 0; font-size: 1.25rem; line-height: 1.25; }
.pw-small { margin: .25rem 0 1rem; font-family: var(--mono-face); font-size: 1.375rem; letter-spacing: .03em; overflow-wrap: anywhere; }
.nato { list-style: none; margin: 0; padding: 0; }
@media (min-width: 640px) { .nato { columns: 2; column-gap: 2rem; } }
.nato li { display: grid; grid-template-columns: 1.75rem minmax(0, 1fr); gap: .625rem; align-items: baseline; padding: .32rem 0; border-bottom: 1px solid var(--rule); break-inside: avoid; }
.nato .n { color: var(--muted); font-family: var(--mono-face); font-size: .875rem; text-align: right; font-variant-numeric: tabular-nums; }
/* Each line is read aloud as written (D8): the character, where the line says it as itself, in the password's face. */
.nato .g { font-family: var(--mono-face); font-size: 1.2em; font-weight: 700; line-height: 1; }
.note { color: var(--muted); font-size: .9375rem; margin: 0 0 .75rem; }
/* Below 360px the sheet takes more of the width, so the longest line, "lowercase n as in November", stays on one row;
   the browser's own cap on a modal dialog's width (100% less 6px and 2em) has to go for that. */
@media (max-width: 359px) {
  dialog.spell { width: calc(100% - 1rem); max-width: none; }
  .sheet { padding-inline: 1rem; }
  .sheet::before { margin-inline: -1rem; }
}

/* The 404 page. */
.lost { display: block; margin-top: 2rem; max-width: 36rem; }
.lost .back { margin-top: 1rem; }
.lost .pw-box { height: auto; padding-block: 1.25rem; }
.lost-code { margin: 0; font-family: var(--mono-face); font-size: 2.5rem; font-weight: 700; letter-spacing: .03em; }
.lost p { margin: .5rem 0 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (forced-colors: active) {
  .envelope, .settings, .pw-box { border-color: CanvasText; }
  .button.primary { border-color: ButtonText; }
  dialog.spell { border: 2px solid CanvasText; }
}
