/* Secure Messenger website — shared styles.
   Fonts are self-hosted on purpose: no requests leave this domain. */

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

@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono.woff2") format("woff2-variations");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --paper: #f7f8fa;
  --paper-raised: #ffffff;
  --ink: #14213d;
  --ink-soft: #4a5672;
  --security-blue: #2b44c9;
  --security-blue-strong: #1f33a3;
  --tint: #dce2f7;
  --tint-line: #c3cdf0;
  --postmark: #b8322a;
  --on-blue: #ffffff;
  --focus-ring: #2b44c9;

  --font-sans: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Modular scale, ratio 1.25 */
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3125rem;
  --step-2: 1.625rem;
  --step-3: 2.0625rem;
  --step-4: clamp(2.25rem, 1.4rem + 3.6vw, 3.875rem);

  --gutter: clamp(1rem, 0.5rem + 2.5vw, 2.5rem);
  --measure: 66ch;
  --page-width: 72rem;
  --radius-small: 4px;
  --radius-large: 14px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1630;
    --paper-raised: #16204166;
    --ink: #e6eaf5;
    --ink-soft: #a9b3cf;
    --security-blue: #8ea2ff;
    --security-blue-strong: #b3c0ff;
    --tint: #1c2850;
    --tint-line: #2a3a6e;
    --postmark: #ff8a80;
    --on-blue: #0e1630;
    --focus-ring: #b3c0ff;
    color-scheme: dark;
  }
}

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

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.55;
  font-stretch: 100%;
  font-kerning: normal;
  font-variant-numeric: proportional-nums;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--security-blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--security-blue-strong);
  text-decoration-thickness: 2px;
}

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

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.1;
  text-wrap: balance;
}

h1,
h2 {
  font-stretch: 125%;
  font-weight: 800;
  letter-spacing: -0.015em;
}

h1 {
  font-size: var(--step-4);
}

h2 {
  font-size: var(--step-3);
}

h3 {
  font-size: var(--step-1);
  font-weight: 700;
  font-stretch: 112%;
}

p {
  margin: 0;
  text-wrap: pretty;
}

code,
.mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: var(--paper);
  z-index: 10;
}

.skip-link:focus {
  top: 0.75rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.page-width {
  width: 100%;
  max-width: var(--page-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Header ---------- */

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

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

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  font-stretch: 125%;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

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

.wordmark img {
  width: 2rem;
  height: 2rem;
  flex: none;
  border-radius: 7px;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: var(--step--1);
  font-weight: 600;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--security-blue);
  text-decoration: underline;
}

@media (max-width: 46rem) {
  .site-nav .nav-optional {
    display: none;
  }
}

@media (max-width: 26rem) {
  .wordmark {
    font-stretch: 108%;
    font-size: 1rem;
    gap: 0.45rem;
  }

  .site-nav ul {
    flex-wrap: nowrap;
    gap: 1rem;
  }
}

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

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 3rem;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius-small);
  border: 2px solid var(--security-blue);
  background: var(--security-blue);
  color: var(--on-blue);
  font: inherit;
  font-weight: 700;
  font-size: var(--step--1);
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: var(--security-blue-strong);
  border-color: var(--security-blue-strong);
  color: var(--on-blue);
  text-decoration: none;
}

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

.button--quiet:hover {
  background: var(--tint);
  color: var(--security-blue-strong);
}

.button[aria-disabled="true"] {
  border-style: dashed;
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--tint-line);
  cursor: default;
}

.button svg {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
}

/* ---------- Security-envelope tint ----------
   The repeating pattern printed inside security envelopes so the
   contents can't be read through the paper. Used only where data is sealed. */

.security-tint {
  background-color: var(--tint);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='14' viewBox='0 0 28 14'%3E%3Cpath d='M0 10 L7 4 L14 10 L21 4 L28 10' fill='none' stroke='%232b44c9' stroke-opacity='0.16' stroke-width='1.4'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  .security-tint {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='14' viewBox='0 0 28 14'%3E%3Cpath d='M0 10 L7 4 L14 10 L21 4 L28 10' fill='none' stroke='%238ea2ff' stroke-opacity='0.18' stroke-width='1.4'/%3E%3C/svg%3E");
  }
}

/* ---------- Hero ---------- */

.hero {
  padding-block: clamp(2.5rem, 1.5rem + 5vw, 5.5rem) clamp(3rem, 2rem + 4vw, 5rem);
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(2.5rem, 1rem + 4vw, 4rem);
  align-items: center;
}

@media (min-width: 60rem) {
  .hero__grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  }
}

.hero__copy {
  display: grid;
  gap: 1.5rem;
  max-width: 34rem;
}

.hero__lede {
  font-size: var(--step-1);
  line-height: 1.45;
  color: var(--ink-soft);
}

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

/* ---------- Seal demo (hero) ---------- */

.seal-demo {
  display: grid;
  gap: 0;
  border: 1px solid var(--tint-line);
  border-radius: var(--radius-large);
  overflow: hidden;
  background: var(--paper-raised);
}

.seal-demo__side {
  display: grid;
  gap: 0.75rem;
  padding: 1.25rem;
}

.seal-demo__side + .seal-demo__side {
  border-top: 1px dashed var(--security-blue);
}

.seal-demo__heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-size: var(--step--1);
  font-weight: 700;
}

.seal-demo__heading span {
  font-weight: 400;
  color: var(--ink-soft);
}

.seal-demo label {
  font-size: var(--step--1);
  font-weight: 600;
}

.seal-demo textarea {
  width: 100%;
  min-height: 4.75rem;
  resize: vertical;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--tint-line);
  border-radius: 12px 12px 12px 4px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  line-height: 1.45;
}

.seal-demo textarea:focus-visible {
  outline-offset: 1px;
}

.server-row {
  margin: 0;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-small);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--ink);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.server-row .key {
  color: var(--ink-soft);
}

.server-row .sealed {
  color: var(--security-blue);
  font-weight: 600;
}

.seal-demo__note {
  font-size: var(--step--1);
  color: var(--ink-soft);
  line-height: 1.45;
}

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

.section {
  padding-block: clamp(3rem, 2rem + 4vw, 5.5rem);
  border-top: 1px solid var(--tint-line);
}

.section__header {
  display: grid;
  gap: 0.9rem;
  max-width: 42rem;
  margin-bottom: clamp(2rem, 1.5rem + 2vw, 3rem);
}

.section__header p {
  color: var(--ink-soft);
  font-size: var(--step-1);
  line-height: 1.45;
}

/* How it works: a real sequence, so it is numbered. */
.steps {
  display: grid;
  gap: 2rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

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

.steps li {
  display: grid;
  gap: 0.6rem;
  align-content: start;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 2px solid var(--security-blue);
  border-radius: 50%;
  color: var(--security-blue);
  font-weight: 800;
  font-stretch: 125%;
}

.steps p {
  color: var(--ink-soft);
}

/* Ledger: what the server keeps vs. what it never gets. */
.ledger {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 52rem) {
  .ledger {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2.5rem;
  }
}

.ledger__column {
  display: grid;
  gap: 1rem;
  align-content: start;
  padding: 1.5rem;
  border-radius: var(--radius-large);
}

.ledger__column--kept {
  border: 1px solid var(--tint-line);
  background: var(--paper-raised);
}

.ledger__column--never {
  color: var(--ink);
}

.ledger dl {
  display: grid;
  gap: 0.9rem;
  margin: 0;
}

.ledger dt {
  font-weight: 700;
}

.ledger dd {
  margin: 0.15rem 0 0;
  color: var(--ink-soft);
}

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

.ledger ul li {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  font-weight: 600;
}

.ledger ul li::before {
  content: "";
  flex: none;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  background: var(--security-blue);
  transform: translateY(0.05rem);
}

/* Feature list: plain two-column prose, no cards. */
.facts {
  display: grid;
  gap: 2rem 3rem;
  margin: 0;
}

@media (min-width: 46rem) {
  .facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.facts div {
  display: grid;
  gap: 0.4rem;
  padding-top: 1rem;
  border-top: 2px solid var(--ink);
}

.facts dt {
  font-weight: 700;
  font-size: var(--step-1);
  font-stretch: 112%;
  line-height: 1.2;
}

.facts dd {
  margin: 0;
  color: var(--ink-soft);
  max-width: 34rem;
}

/* FAQ */
.faq {
  display: grid;
  max-width: 48rem;
  border-top: 1px solid var(--tint-line);
}

.faq details {
  border-bottom: 1px solid var(--tint-line);
}

.faq summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 0;
  font-weight: 700;
  font-size: var(--step-0);
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "";
  flex: none;
  width: 0.65rem;
  height: 0.65rem;
  border-right: 2px solid var(--security-blue);
  border-bottom: 2px solid var(--security-blue);
  transform: rotate(45deg) translateY(-0.2rem);
}

.faq details[open] summary::after {
  transform: rotate(-135deg) translateY(-0.1rem);
}

@media (prefers-reduced-motion: no-preference) {
  .faq summary::after {
    transition: transform 160ms ease-out;
  }
}

.faq .faq__answer {
  display: grid;
  gap: 0.75rem;
  padding: 0 0 1.25rem;
  max-width: var(--measure);
  color: var(--ink-soft);
}

/* Download band */
.download {
  padding-block: clamp(3rem, 2rem + 4vw, 5rem);
}

.download__inner {
  display: grid;
  gap: 1.5rem;
  justify-items: start;
  padding: clamp(1.75rem, 1rem + 3vw, 3rem);
  border-radius: var(--radius-large);
}

.download__inner p {
  max-width: 40rem;
  font-size: var(--step-1);
  line-height: 1.45;
}

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

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

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1.5rem;
}

.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer a {
  color: var(--ink);
}

/* ---------- Long-form documents (guide + legal) ---------- */

.doc-layout {
  display: grid;
  gap: 2.5rem;
  padding-block: clamp(2rem, 1.5rem + 3vw, 4rem) clamp(3rem, 2rem + 4vw, 5rem);
}

/* Title first on phones, then the contents list, then the text.
   On wide screens the contents list sits in a sticky left column. */
@media (min-width: 60rem) {
  .doc-layout {
    grid-template-columns: 14rem minmax(0, 1fr);
    column-gap: 4rem;
    row-gap: 0;
  }

  .doc-intro,
  .doc-layout > .doc,
  .doc-layout--no-toc > .doc {
    grid-column: 2;
  }

  .doc-toc {
    grid-column: 1;
    grid-row: 2;
    position: sticky;
    top: 5.5rem;
    align-self: start;
  }

  .doc-layout > .doc {
    grid-row: 2;
  }

  .doc-layout--no-toc > .doc {
    grid-row: auto;
  }
}

.doc-intro {
  display: grid;
  gap: 0.9rem;
  max-width: var(--measure);
}

@media (min-width: 60rem) {
  .doc-intro {
    padding-bottom: 2.5rem;
  }
}

.doc-intro p {
  color: var(--ink-soft);
  font-size: var(--step-1);
  line-height: 1.45;
}

.doc-intro .updated {
  font-size: var(--step--1);
}

@media (max-width: 59.99rem) {
  .doc-toc {
    padding: 1rem 1.25rem;
    border: 1px solid var(--tint-line);
    border-radius: var(--radius-large);
  }
}

.doc-toc h2 {
  font-size: var(--step--1);
  font-stretch: 100%;
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: 0.75rem;
}

.doc-toc ol {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--step--1);
}

.doc-toc a {
  color: var(--ink-soft);
  text-decoration: none;
}

.doc-toc a:hover {
  color: var(--security-blue);
  text-decoration: underline;
}

.doc {
  max-width: var(--measure);
}

.doc > header {
  display: grid;
  gap: 0.9rem;
  margin-bottom: 2.5rem;
}

.doc > header p {
  color: var(--ink-soft);
  font-size: var(--step-1);
  line-height: 1.45;
}

.doc section {
  display: grid;
  gap: 1rem;
  padding-block: 2rem;
  border-top: 1px solid var(--tint-line);
}

.doc h2 {
  font-size: var(--step-2);
}

.doc h3 {
  margin-top: 0.5rem;
}

.doc ul,
.doc ol {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding-left: 1.4rem;
}

.doc li::marker {
  color: var(--security-blue);
  font-weight: 700;
}

.doc address {
  font-style: normal;
}

.doc .updated {
  font-size: var(--step--1);
  color: var(--ink-soft);
}

.callout {
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--security-blue);
  border-radius: 0 var(--radius-small) var(--radius-small) 0;
  background: var(--tint);
}

.callout--warning {
  border-left-color: var(--postmark);
}

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

.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step--1);
}

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

.doc th {
  font-weight: 700;
}

/* Facts that Aralel still has to fill in before launch. Deliberately loud. */
.fill-in {
  padding: 0 0.2em;
  border-radius: 2px;
  background: #ffe58a;
  color: #3a2c00;
}

/* ---------- 404 ---------- */

.not-found {
  display: grid;
  gap: 1.25rem;
  justify-items: start;
  padding-block: clamp(4rem, 3rem + 6vw, 8rem);
}

.not-found p {
  max-width: 36rem;
  font-size: var(--step-1);
  color: var(--ink-soft);
}
