/* ByteFlow site: a filing cabinet. Every section is a flat folder sheet whose
   heading sits on the folder's tab, and colour marks what's inside: paper for
   general content, cobalt for passwords, navy for encryption, yellow for the
   way in and out. Brand colours come from lib/core/design/tokens.dart.

   Fonts are self-hosted on purpose: privacy.html promises that visiting this
   site contacts nobody but its host, so do not add a font or script CDN. */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  /* Theme tokens. Panels read these so they keep their contrast on any sheet. */
  --base-paper: #f1f5fb;
  --base-raised: #ffffff;
  --base-inset: #e9eff8;
  --base-line: #cfd9e8;
  --base-ink: #101b2d;
  --base-ink-2: #4a5970;
  --base-link: #1a5bd2;

  /* Fixed brand colours, the same in light and dark. */
  --yellow: #fbbf3a;
  --cobalt: #1a5bd2;
  --navy: #0d1b36;
  --night: #101b2d;

  --radius-tab: 22px;
  --radius-panel: 28px;
  --gutter: clamp(16px, 4vw, 40px);
  --edge: max(var(--gutter), calc((100% - 1120px) / 2));
  --tab-room: clamp(128px, 13vw, 176px);
  --ease-out: cubic-bezier(0.33, 1, 0.68, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --base-paper: #0a0f18;
    --base-raised: #131b28;
    --base-inset: #1c2636;
    --base-line: #2c3950;
    --base-ink: #eaf0fa;
    --base-ink-2: #a7b4c8;
    --base-link: #8fbcff;
    --navy: #0d1f42;
  }
}

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

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

body {
  margin: 0;
  background: var(--base-paper);
  color: var(--base-ink);
  font: 400 1.125rem/1.6 "Archivo", system-ui, sans-serif;
  font-stretch: 100%;
  overflow-wrap: break-word;
  overflow-x: clip;
}

h1,
h2,
h3 {
  font-weight: 800;
  font-stretch: 112%;
  line-height: 1.08;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h3 {
  font-size: 1.3125rem;
  font-weight: 700;
  font-stretch: 106%;
  line-height: 1.2;
  margin: 2.1em 0 0.5em;
}

p,
ul,
ol,
dl {
  margin: 0 0 1em;
}

ul,
ol {
  padding-left: 1.25em;
}

li {
  margin-bottom: 0.4em;
}

strong {
  font-weight: 650;
}

a {
  color: var(--link, var(--base-link));
  text-underline-offset: 0.16em;
  text-decoration-thickness: 1px;
  touch-action: manipulation;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 3px;
  border-radius: 6px;
}

code {
  font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: 0.86em;
  overflow-wrap: anywhere;
}

.skip {
  position: absolute;
  left: 16px;
  top: -70px;
  z-index: 40;
  background: var(--night);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
}

.skip:focus {
  top: 12px;
}

/* Header: part of the yellow folder ---------------------------------- */

.site-header {
  background: var(--yellow);
  color: var(--night);
  --link: var(--night);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px var(--edge);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 1.3125rem;
  font-weight: 800;
  font-stretch: 112%;
  letter-spacing: -0.02em;
  color: var(--night);
  text-decoration: none;
}

.brand img {
  display: block;
  width: 34px;
  height: 34px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(4px, 2vw, 16px);
  font-size: 1rem;
  font-weight: 600;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.site-nav .nav-cta {
  background: var(--night);
  color: #fff;
  border-radius: 999px;
  padding: 0 18px;
  margin-left: 4px;
}

.site-nav .nav-cta:hover {
  background: var(--cobalt);
  text-decoration: none;
}

/* Hero: the phone sits in the folder's pocket. The next sheet comes later in
   the DOM, so it paints over the phone's lower edge. ---------------------- */

.hero {
  background: var(--yellow);
  color: var(--night);
  --link: var(--night);
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: end;
  padding: clamp(24px, 5vw, 64px) var(--edge) 0;
}

.hero-copy {
  align-self: center;
  padding-bottom: calc(var(--tab-room) + 16px);
}

.hero h1 {
  font-size: clamp(2.5rem, 1rem + 5.6vw, 5.25rem);
  font-weight: 900;
  font-stretch: 125%;
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin: 0 0 0.45em;
}

.hero p {
  font-size: clamp(1.125rem, 1rem + 0.45vw, 1.375rem);
  line-height: 1.45;
  max-width: 34em;
  margin-bottom: 1.5em;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 28px;
  border-radius: 999px;
  background: var(--night);
  color: #fff;
  font-size: 1.0625rem;
  font-weight: 650;
  text-decoration: none;
  transition: background-color 160ms var(--ease-out), transform 120ms var(--ease-out);
}

.button:hover {
  background: var(--cobalt);
}

.button:active {
  transform: scale(0.97);
}

.hero-actions .plain {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
}

.phone {
  justify-self: center;
  width: min(100%, 320px);
  margin-bottom: -96px;
  background: var(--night);
  border-radius: 46px 46px 0 0;
  padding: 11px 11px 0;
}

@media (prefers-reduced-motion: no-preference) {
  .phone {
    animation: rise-from-pocket 480ms var(--ease-out) both;
  }
}

@keyframes rise-from-pocket {
  from {
    transform: translateY(96px);
  }
}

.screen {
  background: #f1f5fb;
  color: #101b2d;
  border-radius: 36px 36px 0 0;
  overflow: hidden;
  min-height: 540px;
}

.screen img {
  display: block;
  width: 100%;
  height: auto;
}

.mock {
  padding: 40px 15px 72px;
  font-size: 0.875rem;
  line-height: 1.25;
}

.mock-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.mock-sub {
  color: #4a5970;
  margin-bottom: 18px;
}

.mock-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: 16px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.mock-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #e2edfe;
  color: #2a78f0;
}

.mock-icon.is-folder {
  background: #fdf0d5;
  color: #e2960f;
}

.mock-icon svg {
  width: 22px;
  height: 22px;
}

.mock-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mock-meta {
  color: #4a5970;
  font-size: 0.8125rem;
  margin-top: 2px;
}

.mock-lock {
  margin-left: auto;
  flex: none;
  width: 18px;
  height: 18px;
  color: #157a50;
}

/* Folder sheets ------------------------------------------------------- */

.folder {
  position: relative;
  background: var(--sheet);
  color: var(--ink);
  padding: clamp(40px, 6vw, 72px) var(--edge) var(--tab-room);
}

.sheet-paper {
  --sheet: var(--base-paper);
  --ink: var(--base-ink);
  --ink-2: var(--base-ink-2);
  --line: var(--base-line);
  --link: var(--base-link);
  --node: var(--base-raised);
  --node-key: var(--yellow);
}

.sheet-raised {
  --sheet: var(--base-raised);
  --ink: var(--base-ink);
  --ink-2: var(--base-ink-2);
  --line: var(--base-line);
  --link: var(--base-link);
  --node: var(--base-inset);
  --node-key: var(--yellow);
}

.sheet-cobalt {
  --sheet: var(--cobalt);
  --ink: #ffffff;
  --ink-2: #dce8fc;
  --line: rgb(255 255 255 / 0.3);
  --link: #ffffff;
  --node: rgb(255 255 255 / 0.14);
  --node-key: var(--yellow);
}

.sheet-navy {
  --sheet: var(--navy);
  --ink: #eaf0fa;
  --ink-2: #b9c6da;
  --line: rgb(255 255 255 / 0.2);
  --link: #a9cbff;
  --node: rgb(255 255 255 / 0.1);
  --node-key: var(--yellow);
}

.sheet-yellow {
  --sheet: var(--yellow);
  --ink: var(--night);
  --ink-2: #3c3312;
  --line: rgb(16 27 45 / 0.28);
  --link: var(--night);
  --node: rgb(16 27 45 / 0.08);
  --node-key: var(--night);
}

/* The heading is the folder's tab. Anchoring it with bottom: 100% lets it grow
   when the title wraps; --tab-room on the previous sheet leaves the space. */
.tab {
  position: absolute;
  bottom: 100%;
  left: var(--edge);
  max-width: calc(100% - 2 * var(--gutter) - 44px);
  margin: 0;
  padding: 20px 28px 8px;
  background: var(--sheet);
  color: var(--ink);
  border-radius: var(--radius-tab) var(--radius-tab) 0 0;
  font-size: clamp(1.5rem, 1.15rem + 1.9vw, 2.5rem);
  margin-bottom: -1px;
}

.tab::before,
.tab::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: var(--radius-tab);
  height: var(--radius-tab);
  pointer-events: none;
}

.tab::before {
  right: 100%;
  background: radial-gradient(circle at 0 0, transparent calc(var(--radius-tab) - 0.5px), var(--sheet) var(--radius-tab));
}

.tab::after {
  left: 100%;
  background: radial-gradient(circle at 100% 0, transparent calc(var(--radius-tab) - 0.5px), var(--sheet) var(--radius-tab));
}

.inner > * {
  max-width: 44rem;
}

.inner > .wide {
  max-width: none;
}

.lede {
  font-size: 1.3125rem;
  line-height: 1.45;
}

.sheet-note {
  color: var(--ink-2);
}

/* Feature glossary */

.glossary {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  margin-top: 1.75em;
}

.glossary dt {
  font-weight: 700;
  padding: 14px 16px 14px 0;
  border-top: 1px solid var(--line);
}

.glossary dd {
  margin: 0;
  padding: 14px 32px 14px 0;
  border-top: 1px solid var(--line);
}

@media (min-width: 1040px) {
  .glossary {
    grid-template-columns: 9rem minmax(0, 1fr) 9rem minmax(0, 1fr);
  }
}

/* Setup steps: a true sequence, so the numerals carry real meaning. */

.steps {
  list-style: none;
  padding: 0;
  counter-reset: step;
  margin-top: 2em;
}

.inner > .steps {
  max-width: 50rem;
}

.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 5rem;
  margin-bottom: 2.75em;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -0.1em;
  font-size: 3.5rem;
  font-weight: 900;
  font-stretch: 125%;
  line-height: 1;
  color: var(--link);
}

.steps h3 {
  margin-top: 0;
}

/* Tables */

.table-wrap {
  overflow-x: auto;
  margin: 1.5em 0;
}

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

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

thead th {
  border-top: 0;
  color: var(--ink-2);
  font-weight: 500;
}

tbody th {
  font-weight: 650;
  min-width: 9rem;
}

td:last-child,
th:last-child {
  padding-right: 0;
}

/* Panels keep theme colours whatever sheet they sit on. */

.panel {
  --ink: var(--base-ink);
  --ink-2: var(--base-ink-2);
  --link: var(--base-link);
  background: var(--base-raised);
  color: var(--base-ink);
  border-radius: var(--radius-panel);
  padding: clamp(20px, 4vw, 36px);
}

/* One password field, three outcomes. Native radios, so it works by keyboard
   and without any script. */

.unlock-demo {
  margin: 2em 0;
}

.outcome-tabs {
  border: 0;
  padding: 0;
  margin: 0 0 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.outcome-tabs legend {
  padding: 0;
  margin-bottom: 12px;
  font-weight: 700;
}

.outcome-tabs label {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--base-inset);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 160ms var(--ease-out);
}

.outcome-tabs input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.outcome-tabs label:has(input:checked) {
  background: var(--night);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .outcome-tabs label:has(input:checked) {
    background: var(--yellow);
    color: var(--night);
  }
}

.outcome-tabs label:has(input:focus-visible) {
  outline: 3px solid var(--base-link);
  outline-offset: 3px;
}

.fake-field {
  background: var(--base-inset);
  border-radius: 16px;
  padding: 14px 16px;
  letter-spacing: 0.18em;
  margin-bottom: 16px;
}

.outcome {
  display: none;
}

.unlock-demo:has(#o-login:checked) .outcome-login,
.unlock-demo:has(#o-destroy:checked) .outcome-destroy,
.unlock-demo:has(#o-other:checked) .outcome-other {
  display: block;
}

.outcome h3 {
  margin: 0 0 0.3em;
}

.outcome p:last-child {
  margin-bottom: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .outcome {
    animation: outcome-in 220ms var(--ease-out);
  }
}

@keyframes outcome-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* Key diagram */

.keys {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 16px minmax(0, 1fr) 16px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin: 1.75em 0 0.75em;
}

.keys-in {
  display: grid;
  gap: 12px;
}

.key-node {
  background: var(--node);
  border-radius: 16px;
  padding: 14px 16px;
  line-height: 1.25;
}

.key-node.is-key {
  background: var(--node-key);
  color: var(--night);
}

.key-node strong {
  display: block;
  font-size: 1rem;
}

.key-node span {
  display: block;
  margin-top: 4px;
  font-size: 0.875rem;
}

.key-flow {
  width: 16px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.figure-note {
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--ink-2);
}

/* Erased / kept */

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(20px, 4vw, 40px);
  margin: 1.5em 0;
}

.split h3 {
  margin-top: 0;
}

.split ul {
  margin-bottom: 0;
}

/* Bytes in the bucket */

.bytes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 1.75em 0 0.75em;
}

.bytes figure {
  margin: 0;
  border-radius: 22px;
  padding: 18px 20px;
  background: var(--node);
  min-width: 0;
}

.bytes figcaption {
  font-weight: 700;
  margin-bottom: 12px;
}

.bytes pre {
  margin: 0;
  font: 400 0.875rem/1.65 ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bytes .readable {
  color: var(--yellow);
}

.bytes .magic {
  color: #a9cbff;
}

/* Warnings: reserved for what can cost someone their data. Fixed colours, so
   they read the same on every sheet. */

.warning {
  background: #fde6ec;
  color: #101b2d;
  border-radius: 16px;
  padding: 16px 20px;
  margin: 1.5em 0;
}

.warning p:last-child {
  margin-bottom: 0;
}

.warning strong {
  color: #b3213f;
}

/* Downloads ------------------------------------------------------------ */

.folder#download {
  padding-bottom: clamp(56px, 8vw, 96px);
}

.downloads {
  list-style: none;
  padding: 0;
  margin: 1.5em 0 0;
}

.downloads > li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 15rem;
  gap: 12px 32px;
  align-items: center;
  padding: 24px 0;
  margin: 0;
  border-top: 2px solid var(--line);
}

.downloads h3 {
  margin: 0 0 0.25em;
  font-size: 1.625rem;
  font-weight: 800;
}

.downloads p {
  margin: 0;
  max-width: 40rem;
}

.dl-slot {
  display: flex;
  justify-content: stretch;
}

.dl-slot .button {
  width: 100%;
}

/* Shown until a store address is set in site.js. */
.dl-soon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  border-radius: 999px;
  border: 2px dashed var(--ink);
  font-weight: 650;
}

/* Legal pages ---------------------------------------------------------- */

.legal-band {
  background: var(--yellow);
  height: clamp(112px, 14vw, 152px);
}

.legal .tab {
  font-size: clamp(2rem, 1.4rem + 3vw, 3.25rem);
  font-weight: 900;
  font-stretch: 118%;
}

.folder.legal {
  padding-bottom: 72px;
}

.legal h2 {
  font-size: 1.5rem;
  margin: 2em 0 0.5em;
}

.dated {
  color: var(--ink-2);
  font-size: 1rem;
}

/* Footer --------------------------------------------------------------- */

.foot {
  background: var(--night);
  color: #dce8fc;
  --link: #ffffff;
  padding: 28px var(--edge) 36px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 32px;
  font-size: 1rem;
}

.foot p {
  margin: 0;
}

.foot nav {
  display: flex;
  gap: 8px 20px;
}

.foot nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

/* Narrow screens ------------------------------------------------------- */

@media (max-width: 880px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-copy {
    padding-bottom: 8px;
  }

  .phone {
    width: min(78%, 300px);
    margin-bottom: -150px;
  }

  .screen {
    min-height: 0;
    max-height: 520px;
  }

  #what {
    padding-top: clamp(40px, 6vw, 72px);
  }

  .site-nav .nav-optional {
    display: none;
  }
}

@media (max-width: 620px) {
  body {
    font-size: 1.0625rem;
  }

  .split,
  .bytes,
  .glossary,
  .downloads > li {
    grid-template-columns: minmax(0, 1fr);
  }

  .glossary dd {
    border-top: 0;
    padding-top: 0;
    padding-right: 0;
  }

  .glossary dt {
    padding-bottom: 2px;
  }

  .steps > li {
    padding-left: 0;
    padding-top: 3.75rem;
  }

  .steps > li::before {
    top: 0;
  }

  .tab {
    padding: 16px 20px 6px;
  }

  .keys {
    grid-template-columns: minmax(0, 1fr);
  }

  .key-flow {
    justify-self: center;
    transform: rotate(90deg);
  }
}

@media (max-width: 420px) {
  .site-nav a:not(.nav-cta) {
    display: none;
  }
}

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

  .button {
    transition: none;
  }

  .button:active {
    transform: none;
  }
}
