/*
 * The Punicus website's one stylesheet. Everything the pages load is in this folder tree: no
 * CDN, no web-font service, no script from elsewhere (website/README.md, "Self-contained").
 *
 * The palette is the app's and the logo's: the logo's navy as ink, the app's violet for what can
 * be tapped, its green for "checked on chain", on the app's pale lavender surface. Night is the
 * app's dark theme.
 */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("../fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible Mono";
  src: url("../fonts/atkinson-hyperlegible-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --paper: #fbf8ff;
  --panel: #f1ebfb;
  --panel-strong: #e6dcf7;
  --ink: #1b2a41;
  --ink-soft: #4a566b;
  --line: #d6cde8;
  --violet: #5d45a3;
  --violet-ink: #ffffff;
  --proof: #1c7448;
  --proof-wash: #dff3e7;
  --warn: #8a4b0f;
  --warn-wash: #fbecd7;

  --sans: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Atkinson Hyperlegible Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --measure: 62ch;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14121b;
    --panel: #1e1a2a;
    --panel-strong: #2a2440;
    --ink: #ece7f6;
    --ink-soft: #b3abc6;
    --line: #3a3352;
    --violet: #cdbcff;
    --violet-ink: #23164d;
    --proof: #7fd8a6;
    --proof-wash: #17301f;
    --warn: #f0c088;
    --warn-wash: #33240f;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.125rem;
  line-height: 1.6;
  font-weight: 400;
}

img,
svg {
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.12;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.5rem, 6.2vw, 4.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.02;
}

h2 {
  font-size: clamp(1.8rem, 3.6vw, 2.6rem);
  font-weight: 750;
}

h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0;
}

p {
  margin: 0;
  max-width: var(--measure);
  text-wrap: pretty;
}

p + p {
  margin-top: 0.9em;
}

a {
  color: var(--violet);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 0.14em;
}

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

code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--panel);
  border-radius: 5px;
  padding: 0.08em 0.35em;
  overflow-wrap: anywhere;
}

.wrap {
  width: min(100% - 2 * var(--gutter), 70rem);
  margin-inline: auto;
}

.lede {
  font-size: clamp(1.2rem, 1.9vw, 1.4rem);
  line-height: 1.5;
  color: var(--ink-soft);
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  background: var(--violet);
  color: var(--violet-ink);
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  z-index: 10;
}

.skip:focus {
  top: 0.75rem;
}

/* ---- The top bar ----------------------------------------------------------------------- */

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.top .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

/* The bat: the logo's own two files, the dark one on the dark theme. */
.bat {
  display: block;
  width: 2.9rem;
  height: auto;
}

.top nav {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2.4vw, 1.75rem);
  font-size: 1rem;
}

.top nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 0.4rem 0;
  white-space: nowrap;
}

.top nav a:hover,
.top nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 0.12em;
}

.top nav a.optional {
  display: none;
}

@media (min-width: 46rem) {
  .top nav a.optional {
    display: inline;
  }
}

/* ---- Buttons --------------------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 3rem;
  padding: 0.6rem 1.35rem;
  border-radius: 999px;
  border: 2px solid var(--violet);
  background: var(--violet);
  color: var(--violet-ink);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
}

.button:hover {
  filter: brightness(1.1);
}

.button.quiet {
  background: transparent;
  color: var(--violet);
}

.button small {
  font-weight: 400;
  font-size: 0.85em;
  opacity: 0.85;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.actions.after {
  margin-top: 2rem;
}

.closing h2 + .lede {
  margin-top: 1rem;
}

.closing h3 + p {
  margin-top: 0.5rem;
}

/* ---- The hero -------------------------------------------------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.hero .wrap {
  display: grid;
  gap: 2.5rem;
  align-items: center;
  padding-block: clamp(2.5rem, 7vw, 5.5rem) 0;
}

.hero-copy {
  padding-bottom: clamp(0rem, 4vw, 4rem);
}

.hero-copy .lede {
  margin-top: 1.4rem;
}

.hero-copy .actions {
  margin-top: 2rem;
}

.hero-copy .fine {
  margin-top: 1.1rem;
  font-size: 1rem;
  color: var(--ink-soft);
}

.hero-stage {
  position: relative;
  display: grid;
  justify-items: center;
  align-self: end;
}

/* The echo: rings that go out from the wallet, and the peers that answer. A bat finds its way
   by its own call and what comes back, which is how the wallet reads the chain. Drawn once, on
   load; still when the reader asks for less motion. */
.echo {
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(150%, 52rem);
  max-width: none;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.echo circle.ring {
  fill: none;
  stroke: var(--violet);
  stroke-width: 1.4;
  transform-origin: 400px 400px;
  opacity: 0;
  animation: ring 1.5s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

.echo circle.peer {
  fill: var(--proof);
  opacity: 0;
  animation: peer 0.5s ease-out forwards;
}

.echo .ring:nth-of-type(1) { animation-delay: 0.1s; --to: 0.5; }
.echo .ring:nth-of-type(2) { animation-delay: 0.3s; --to: 0.36; }
.echo .ring:nth-of-type(3) { animation-delay: 0.5s; --to: 0.25; }
.echo .ring:nth-of-type(4) { animation-delay: 0.7s; --to: 0.16; }
.echo .peer:nth-of-type(5) { animation-delay: 1.2s; }
.echo .peer:nth-of-type(6) { animation-delay: 1.32s; }
.echo .peer:nth-of-type(7) { animation-delay: 1.44s; }
.echo .peer:nth-of-type(8) { animation-delay: 1.56s; }
.echo .peer:nth-of-type(9) { animation-delay: 1.68s; }
.echo .peer:nth-of-type(10) { animation-delay: 1.8s; }
.echo .peer:nth-of-type(11) { animation-delay: 1.92s; }

@keyframes ring {
  from { opacity: 0; transform: scale(0.55); }
  to { opacity: var(--to, 0.3); transform: scale(1); }
}

@keyframes peer {
  from { opacity: 0; }
  to { opacity: 0.9; }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .echo circle.ring {
    animation: none;
    opacity: 0.28;
  }

  .echo circle.peer {
    animation: none;
    opacity: 0.9;
  }
}

/* A phone, as far as a frame says "phone": the app's own screen inside. */
.phone {
  position: relative;
  width: min(100%, 19rem);
  margin: 0;
  border: 0.55rem solid var(--ink);
  border-bottom: 0;
  border-radius: 2.4rem 2.4rem 0 0;
  background: var(--ink);
  overflow: hidden;
  line-height: 0;
}

@media (prefers-color-scheme: dark) {
  .phone {
    border-color: #3d3657;
    background: #3d3657;
  }
}

.phone img {
  display: block;
  width: 100%;
  aspect-ratio: 412 / 640;
  object-fit: cover;
  object-position: top;
  border-radius: 1.85rem 1.85rem 0 0;
}

@media (min-width: 56rem) {
  .hero .wrap {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 3rem;
  }
}

/* ---- Sections -------------------------------------------------------------------------- */

.section {
  padding-block: clamp(3.5rem, 8vw, 6.5rem);
}

.section + .section {
  border-top: 1px solid var(--line);
}

.section.tinted {
  background: var(--panel);
}

.section-head {
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

.section-head p {
  margin-top: 1rem;
}

/* ---- "Who tells the app what you own": the two paths ------------------------------------ */

.paths {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 52rem) {
  .paths {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
}

.path {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 2rem);
  background: var(--paper);
}

.path.ours {
  border: 2px solid var(--proof);
}

.path h3 {
  font-size: 1.4rem;
}

.path ol {
  list-style: none;
  margin: 1.4rem 0 0;
  padding: 0;
}

.path li {
  position: relative;
  padding: 0 0 1.5rem 2.25rem;
}

.path li:last-child {
  padding-bottom: 0;
}

/* The line a question and its answer travel along, and the stops on it. */
.path li::before {
  content: "";
  position: absolute;
  left: 0.4rem;
  top: 0.45em;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  border: 2px solid var(--ink-soft);
  background: var(--paper);
  z-index: 1;
}

.path li::after {
  content: "";
  position: absolute;
  left: calc(0.8rem - 1px);
  top: 0.9em;
  bottom: -0.45em;
  width: 2px;
  background: var(--line);
}

.path li:last-child::after {
  display: none;
}

.path.ours li::before {
  border-color: var(--proof);
}

.path.ours li.checked::before {
  background: var(--proof);
}

.path li strong {
  display: block;
}

.path li span {
  display: block;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.5;
}

.path .outcome {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 1.05rem;
}

.means {
  display: grid;
  gap: 2rem;
  margin-top: clamp(2.5rem, 5vw, 4rem);
}

@media (min-width: 52rem) {
  .means {
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
  }
}

.means h3 + p {
  margin-top: 0.5rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

/* ---- What you can do: the app's screens ------------------------------------------------- */

.screens {
  display: grid;
  gap: 3rem 2rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}

.screen figure {
  margin: 0;
}

.screen .shot {
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  overflow: hidden;
  background: var(--panel);
  line-height: 0;
  max-width: 21rem;
}

.screen .shot img {
  display: block;
  width: 100%;
  aspect-ratio: 412 / 560;
  object-fit: cover;
  object-position: top;
}

.screen h3 {
  margin-top: 1.25rem;
}

.screen p {
  margin-top: 0.5rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.also {
  margin-top: clamp(3rem, 6vw, 4.5rem);
}

.also dl {
  display: grid;
  gap: 1.5rem 2.5rem;
  margin: 1.5rem 0 0;
}

@media (min-width: 46rem) {
  .also dl {
    grid-template-columns: 1fr 1fr;
  }
}

.also dt {
  font-weight: 700;
}

.also dd {
  margin: 0.2rem 0 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
  max-width: var(--measure);
}

/* ---- Keys, and what leaves the device -------------------------------------------------- */

.split {
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 56rem) {
  .split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 4rem;
  }
}

.points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.5rem;
}

.points h3 + p {
  margin-top: 0.4rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  line-height: 1.45;
}

caption {
  text-align: left;
  font-weight: 700;
  font-size: 1.25rem;
  padding-bottom: 0.75rem;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.75rem 1rem 0.75rem 0;
  border-top: 1px solid var(--line);
}

th {
  font-weight: 700;
}

thead th {
  border-top: 0;
  color: var(--ink-soft);
  font-weight: 400;
  font-size: 0.95rem;
}

.note {
  margin-top: 1.25rem;
  font-size: 1rem;
  color: var(--ink-soft);
}

/* ---- Download -------------------------------------------------------------------------- */

.callout {
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  background: var(--warn-wash);
  color: var(--warn);
  max-width: 46rem;
}

.callout p {
  max-width: none;
}

.release-line {
  margin-top: 2rem;
  font-size: 1.1rem;
}

.downloads {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  border-bottom: 1px solid var(--line);
}

.downloads > li {
  display: grid;
  gap: 1rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--line);
}

@media (min-width: 52rem) {
  .downloads > li {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2.5rem;
    align-items: center;
  }
}

.downloads h3 {
  font-size: 1.4rem;
}

.downloads h3 + p {
  margin-top: 0.35rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.downloads .files {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.downloads .later {
  color: var(--ink-soft);
  font-size: 1rem;
}

details {
  margin-top: 1.5rem;
  max-width: 46rem;
}

summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--violet);
  padding: 0.35rem 0;
}

details > *:not(summary) {
  margin-top: 0.75rem;
}

pre {
  margin: 0.75rem 0 0;
  padding: 0.9rem 1.1rem;
  background: var(--panel);
  border-radius: 10px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.5;
}

.section.tinted pre,
.section.tinted code {
  background: var(--panel-strong);
}

/* ---- The guide ------------------------------------------------------------------------- */

.page-head {
  padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(2rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line);
}

.page-head h1 {
  font-size: clamp(2.3rem, 5.4vw, 3.6rem);
}

.page-head .lede {
  margin-top: 1.25rem;
}

.toc {
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 1.05rem;
  column-gap: 2.5rem;
}

.toc li {
  padding-block: 0.2rem;
  break-inside: avoid;
}

@media (min-width: 46rem) {
  .toc {
    columns: 2;
    max-width: 50rem;
  }
}

.kinds {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 52rem) {
  .kinds {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
  }
}

.kind {
  border-top: 3px solid var(--ink);
  padding-top: 1rem;
}

.kind p {
  margin-top: 0.5rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.badge {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.1rem 0.6rem;
  border-radius: 6px;
  background: var(--panel-strong);
  font-size: 0.9rem;
  font-weight: 700;
}

.walk {
  display: grid;
  gap: 2.5rem;
  align-items: start;
}

@media (min-width: 60rem) {
  .walk {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr);
    gap: 3.5rem;
  }

  /* A part with three screens: the steps first, the screens across the page below them. */
  .walk.wide {
    grid-template-columns: minmax(0, 1fr);
  }
}

.walk .when {
  margin-top: 1rem;
  color: var(--ink-soft);
}

/* The steps are a sequence, so they are numbered. */
.steps {
  list-style: none;
  counter-reset: step;
  margin: 1.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
}

.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 3rem;
  max-width: var(--measure);
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -0.1rem;
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  font-size: 1rem;
}

.steps .ui {
  font-weight: 700;
}

.steps li p {
  margin-top: 0.3rem;
  color: var(--ink-soft);
  font-size: 1.02rem;
}

.shots {
  display: flex;
  gap: 1rem;
  margin: 0;
  padding: 0 0 0.75rem;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x proximity;
}

.shots li {
  flex: 0 0 min(78%, 19rem);
  scroll-snap-align: start;
}

.shots figure {
  margin: 0;
}

.shots img {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
}

/* A screen shown down to where its content ends: `--rows` of its 892 rows, set on the image. The
   screens that show a recovery phrase or take the password are cut above their last line, the
   notice that screen capture cannot be blocked: the desktop and iOS apps show it, the Android
   app, which blocks capture, does not, and these pages show the phone app (website/README.md). */
.shots img.crop {
  aspect-ratio: 412 / var(--rows, 690);
  object-fit: cover;
  object-position: top;
}

/* A spot on a screen that a step points at: an outline drawn over the image, which is not
   changed. `--top` and `--height` place it, as shares of the image's height. */
.shots .frame {
  position: relative;
}

.shots .mark {
  position: absolute;
  left: 1.5%;
  right: 1.5%;
  top: var(--top);
  height: var(--height);
  border: 3px solid var(--warn);
  border-radius: 0.7rem;
  pointer-events: none;
}

.shots figcaption {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--ink-soft);
}

.caution {
  margin-top: 1.75rem;
  border-left: 4px solid var(--warn);
  padding: 0.25rem 0 0.25rem 1rem;
  color: var(--ink);
  font-size: 1.05rem;
}

.proofline {
  margin-top: 1.75rem;
  border-left: 4px solid var(--proof);
  padding: 0.25rem 0 0.25rem 1rem;
  font-size: 1.05rem;
}

.next {
  display: grid;
  gap: 2rem;
}

@media (min-width: 52rem) {
  .next {
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
  }
}

.next p {
  margin-top: 0.5rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

/* ---- The footer ------------------------------------------------------------------------ */

.foot {
  border-top: 1px solid var(--line);
  padding-block: 3rem;
  font-size: 1rem;
  color: var(--ink-soft);
}

.foot .wrap {
  display: grid;
  gap: 2rem;
}

@media (min-width: 46rem) {
  .foot .wrap {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 3rem;
  }
}

.foot .brand {
  font-size: 1.15rem;
}

.foot p {
  margin-top: 0.75rem;
}

.foot h2 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--ink);
}

.foot ul {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
