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

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

/* Each colour is light-dark(light, dark). The page is dark until the theme
   button sets data-theme="light" on <html>. The navy and gold come from the
   app icon (src-tauri/icons/subclave-mark.svg in the app repo). */
:root {
  --paper: light-dark(#eef1f8, #111b3d);
  --card: light-dark(#ffffff, #18244d);
  --ink: light-dark(#101a3c, #edf0f8);
  --slate: light-dark(#4e5978, #9ea9c8);
  --rule: light-dark(#d3d9e8, #2a3868);
  --gold-ink: light-dark(#8a5a00, #f5b83d);
  --focus: light-dark(#1d2b53, #f5b83d);
  --btn-hover: light-dark(#e2a52c, #ffc95a);
  --chip: light-dark(rgb(29 43 83 / 0.07), rgb(158 169 200 / 0.14));
  --chip-edge: light-dark(rgb(29 43 83 / 0.22), rgb(158 169 200 / 0.32));
  --gold: #f5b83d;
  --navy: #101a3c;
  --term: #0a1128;
  --on-term: #e6e9f4;

  --pad: clamp(1.25rem, 4vw, 3rem);
  --sans: "Atkinson Next", ui-sans-serif, system-ui, sans-serif;
  --mono: "Atkinson Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: dark;
}

/* Browsers without light-dark() get the dark palette. */
@supports not (color: light-dark(#000, #fff)) {
  :root {
    --paper: #111b3d;
    --card: #18244d;
    --ink: #edf0f8;
    --slate: #9ea9c8;
    --rule: #2a3868;
    --gold-ink: #f5b83d;
    --focus: #f5b83d;
    --btn-hover: #ffc95a;
    --chip: rgb(158 169 200 / 0.14);
    --chip-edge: rgb(158 169 200 / 0.32);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
}

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

html {
  scrollbar-gutter: stable;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--gold);
  color: var(--navy);
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
figure,
pre {
  margin: 0;
}

p,
li {
  text-wrap: pretty;
}

a {
  color: var(--ink);
  text-decoration-color: var(--gold-ink);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.22em;
}

a:hover {
  color: var(--gold-ink);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

code,
kbd,
pre {
  font-family: var(--mono);
}

code,
kbd {
  font-size: 0.9em;
}

:not(pre) > code,
kbd {
  padding: 0.08em 0.3em;
  border-radius: 4px;
  background: var(--chip);
}

kbd {
  border-bottom: 2px solid var(--chip-edge);
}

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

.skip {
  position: absolute;
  left: var(--pad);
  top: -4rem;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
}

.skip:focus {
  top: 1rem;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Header */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.25rem;
}

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

.nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2rem);
  font-size: 0.95rem;
}

.nav a {
  color: var(--slate);
  text-decoration: none;
}

.nav a:hover {
  color: var(--ink);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: none;
  color: var(--ink);
  cursor: pointer;
}

.theme-toggle[hidden] {
  display: none;
}

.theme-toggle:hover {
  border-color: var(--slate);
}

/* Hero */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2.5rem, 6vw, 5rem);
  padding-block: clamp(3rem, 8vw, 6.5rem) clamp(4rem, 9vw, 7rem);
}

.hero h1 {
  max-width: 12ch;
  font-size: clamp(2.6rem, 1.3rem + 4.4vw, 4.6rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.hero-lead {
  max-width: 38ch;
  margin-top: 1.5rem;
  color: var(--slate);
  font-size: 1.1875rem;
}

.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin-top: 2.25rem;
}

.btn {
  display: inline-block;
  padding: 0.95rem 1.6rem;
  border-radius: 999px;
  background: var(--gold);
  color: var(--navy);
  font-weight: 750;
  text-decoration: none;
}

.btn:hover {
  background: var(--btn-hover);
  color: var(--navy);
}

.cta-alt {
  font-weight: 600;
}

.cta-file {
  margin-top: 1rem;
  color: var(--slate);
  font-size: 0.875rem;
}

.cta-file code {
  padding: 0;
  background: none;
}

/* Route: the app icon's S, drawn as the path one login takes between two
   computers. The tile stays navy in both themes, like the icon. */

.route {
  justify-self: end;
  width: 100%;
  max-width: 36rem;
  overflow: visible;
}

.route .tile {
  fill: url(#route-tile);
  stroke: var(--rule);
  stroke-width: 0.3;
}

.route .s {
  fill: none;
  stroke: var(--gold);
  stroke-width: 12;
  stroke-linecap: round;
}

.route text {
  font-family: var(--mono);
  font-size: 4.2px;
  fill: #edf0f8;
}

.route .place {
  font-family: var(--sans);
  font-size: 3.4px;
  font-weight: 700;
  fill: #9ea9c8;
}

.route .secret {
  fill: #9ea9c8;
}

.route .hash {
  fill: var(--gold);
}

@media (prefers-reduced-motion: no-preference) {
  .route .s {
    stroke-dasharray: 1 1.01;
    stroke-dashoffset: 1;
    animation: draw 1.6s cubic-bezier(0.6, 0, 0.3, 1) 0.1s both;
  }

  .route .lb {
    animation: rise 0.5s ease-out var(--d) both;
  }
}

@keyframes draw {
  0% {
    opacity: 0;
  }
  1% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    stroke-dashoffset: 0;
  }
}

@keyframes rise {
  from {
    opacity: 0;
  }
}

/* Screenshots */

/* Never wider than the capture, so the small browser crop stays sharp. */
.shot img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: 0 28px 56px -28px rgb(8 13 32 / 0.55);
}

.zoom {
  display: block;
  width: fit-content;
  max-width: 100%;
  cursor: zoom-in;
}

.shot-wide {
  margin-top: 2rem;
}

.shot figcaption {
  margin-top: 0.75rem;
  color: var(--slate);
  font-size: 0.9rem;
}

/* Screenshot viewer */

body:has(.viewer[open]) {
  overflow: hidden;
}

.viewer {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: 3.75rem 1.5rem 1.5rem;
  border: 0;
  background: none;
  cursor: zoom-out;
}

.viewer[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.viewer::backdrop {
  background: rgb(8 13 32 / 0.92);
}

.viewer img {
  max-width: 100%;
  max-height: 100%;
  border: 1px solid #2a3868;
}

.viewer-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid #2a3868;
  border-radius: 999px;
  background: #18244d;
  color: #edf0f8;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

/* Parts: one per area of the app. The left column names the area and says
   where its secrets are kept, the right column holds the detail. */

.parts {
  padding-bottom: clamp(1rem, 3vw, 2rem);
}

.part {
  display: grid;
  grid-template-columns: minmax(0, 14rem) minmax(0, 1fr);
  gap: 1.5rem clamp(2rem, 5vw, 4.5rem);
  padding-block: clamp(3rem, 7vw, 5.5rem);
  border-top: 1px solid var(--rule);
}

.part-head {
  align-self: start;
  position: sticky;
  top: 1.5rem;
}

.part h2 {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.3;
}

.where {
  position: relative;
  max-width: 16rem;
  margin-top: 0.6rem;
  padding-left: 1.1rem;
  color: var(--slate);
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.5;
}

/* The S stroke's round cap, as a marker. */
.where::before {
  content: "";
  position: absolute;
  top: 0.42em;
  left: 0;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--gold);
}

.claim {
  max-width: 22ch;
  font-size: clamp(1.55rem, 1.1rem + 1.4vw, 2.2rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.claim-note {
  max-width: 44rem;
  margin-top: 1rem;
  color: var(--slate);
}

.facts {
  margin-top: 1.75rem;
  padding: 0;
  list-style: none;
}

.facts li {
  position: relative;
  padding-left: 1.4rem;
}

.facts li + li {
  margin-top: 0.85rem;
}

.facts li::before {
  content: "";
  position: absolute;
  top: 0.66em;
  left: 0;
  width: 0.75rem;
  height: 4px;
  border-radius: 2px;
  background: var(--gold);
}

.facts-wide {
  columns: 2 20rem;
  column-gap: 3rem;
}

.facts-wide li {
  break-inside: avoid;
}

.cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 2rem clamp(2rem, 4vw, 3.5rem);
}

.cols.with-shot {
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
}

.cols > .facts,
.cols > figure {
  margin-top: 1.75rem;
}

.specs {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.45rem 1.5rem;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}

.specs dt {
  color: var(--slate);
  font-size: 0.9rem;
  line-height: 1.75;
}

.more {
  margin-top: 2rem;
  color: var(--slate);
}

/* Browser: the chain a fill runs along, left to right, and top to bottom
   on narrow screens. */

.hops {
  margin-top: 2.5rem;
  padding: 1.5rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
}

.hops ol {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
  padding: 0;
  list-style: none;
}

.hops li {
  position: relative;
  padding-top: 1.5rem;
  color: var(--slate);
  font-size: 0.95rem;
}

.hops li::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--gold);
}

.hops li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: calc(0.35rem - 2px);
  left: 1.1rem;
  right: -1.1rem;
  height: 4px;
  border-radius: 2px;
  background: var(--gold);
  opacity: 0.45;
}

.hops b {
  display: block;
  color: var(--ink);
  font-family: var(--mono);
  font-weight: 700;
}

.hops figcaption {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  color: var(--slate);
  font-size: 0.9rem;
}

/* Sync: what the storage holds. */

.listing {
  margin-top: 2.25rem;
}

.term {
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  background: var(--term);
  color: var(--on-term);
  border-radius: 10px;
  font-size: 0.82rem;
  line-height: 1.75;
}

.term .prompt {
  color: var(--gold);
}

.listing figcaption {
  max-width: 44rem;
  margin-top: 0.8rem;
  color: var(--slate);
  font-size: 0.9rem;
}

/* Threat model */

.list-h {
  margin-top: 1.75rem;
  font-size: 1rem;
  font-weight: 800;
}

.list-h + .facts {
  margin-top: 1rem;
}

.facts-not li::before {
  background: var(--slate);
}

/* Download */

.platforms {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2.25rem;
}

.platform,
.extension {
  padding: 1.5rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
}

.platform {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.platform.is-yours {
  border-color: var(--gold);
  box-shadow: inset 0 4px 0 var(--gold);
}

.platform h3,
.extension h3 {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: 1.25rem;
  font-weight: 800;
}

.platform.is-yours h3::after {
  content: "Your system";
  margin-left: auto;
  color: var(--gold-ink);
  font-size: 0.8rem;
  font-weight: 700;
}

.req {
  color: var(--slate);
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 400;
}

.files {
  padding: 0;
  list-style: none;
}

.files a {
  display: flex;
  gap: 0.4rem;
  padding-block: 0.6rem;
  border-top: 1px solid var(--rule);
  font-weight: 700;
  text-decoration: none;
}

.files li:last-child a {
  border-bottom: 1px solid var(--rule);
}

.files a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--gold-ink);
}

.files a::after {
  content: attr(data-size);
  margin-left: auto;
  color: var(--slate);
  font-weight: 400;
}

.files code {
  padding: 0;
  background: none;
}

.note {
  color: var(--slate);
  font-size: 0.9rem;
}

.note code {
  overflow-wrap: anywhere;
}

.cmd {
  margin-top: -0.25rem;
  padding: 0.75rem 1rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--term);
  color: var(--on-term);
  border-radius: 6px;
  font-size: 0.85rem;
}

.extension {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 1.5rem clamp(2rem, 4vw, 3rem);
  margin-top: 1rem;
}

.extension h3 {
  margin-bottom: 1rem;
}

.extension .note {
  margin-top: 1rem;
}

/* Install steps are a real order, so they keep their numbers. */
.steps {
  margin: 0;
  padding-left: 1.5rem;
  color: var(--slate);
  font-size: 0.95rem;
}

.steps li + li {
  margin-top: 0.75rem;
}

.steps li::marker {
  color: var(--gold-ink);
  font-family: var(--mono);
  font-weight: 700;
}

/* Footer */

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding-block: 2rem 3rem;
  border-top: 1px solid var(--rule);
  color: var(--slate);
  font-size: 0.9rem;
}

.foot a {
  color: var(--slate);
  text-decoration-color: var(--rule);
}

.foot a:hover {
  color: var(--ink);
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

/* Narrow screens */

/* Four steps in a row need more room than the other two-column layouts:
   below this width "subclave-proxy" no longer fits on one line. */
@media (max-width: 1100px) {
  .hops ol {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .hops li {
    padding: 0 0 1.25rem 1.75rem;
  }

  .hops li::before {
    top: 0.45em;
  }

  .hops li:not(:last-child)::after {
    top: 1.2em;
    bottom: -0.25em;
    left: calc(0.35rem - 2px);
    right: auto;
    width: 4px;
    height: auto;
  }
}

@media (max-width: 960px) {
  .hero,
  .part,
  .cols,
  .cols.with-shot,
  .platforms,
  .extension {
    grid-template-columns: minmax(0, 1fr);
  }

  .route {
    justify-self: start;
  }

  .part-head {
    position: static;
  }

  .where {
    max-width: none;
  }
}

@media (max-width: 640px) {
  .nav a[href="#vault"] {
    display: none;
  }

  .nav {
    gap: 0.75rem;
  }

  .route text {
    font-size: 5px;
  }

  .route .place {
    font-size: 4.2px;
  }
}
