/* RedactOffline — shared stylesheet.
   Tokens are the app's own, from Sources/Views/DesignSystem.swift. Accent is for
   actions only: CTAs, links, selection. Never a wash, never decorative.
   Fonts are self-hosted; the site makes no third-party requests and needs no JS. */

/* ---------------------------------------------------------------- fonts --- */

@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* Metric-matched fallback so headings don't reflow when Archivo arrives.
   Archivo: upem 1000, x-height 526, ascent 878, descent 210.
   Arial:   upem 2048, x-height 1062 (ratio 0.5186).
   size-adjust = 0.526 / 0.5186; ascent/descent are divided by that. */
@font-face {
  font-family: "Archivo Fallback";
  src: local("Helvetica Neue"), local("Arial"), local("Segoe UI"), local("Roboto");
  size-adjust: 101.44%;
  ascent-override: 86.56%;
  descent-override: 20.70%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/plexmono-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/plexmono-latin-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---------------------------------------------------------------- tokens --- */

:root {
  /* Colours — locked to the app */
  --color-accent: #007AFF;
  --color-accent-pressed: #0059BF;
  --color-ink: #1C1C1F;
  --color-ink-secondary: rgba(28, 28, 31, 0.62);
  --color-divider: rgba(28, 28, 31, 0.16);
  --color-canvas: #FFFFFF;
  --color-dark-bg: #1C1C1F;
  --color-dark-raised: #2E2E30;

  /* The redaction mark. Ink, never blue — blue has to keep meaning "you can tap this". */
  --color-mark: #1C1C1F;
  --color-mark-text: #FFFFFF;

  /* Surfaces derived from the above */
  --color-surface: #FFFFFF;
  --color-code-bg: rgba(28, 28, 31, 0.06);

  /* Type */
  --font-display: "Archivo", "Archivo Fallback", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: clamp(1.15rem, 1rem + 0.6vw, 1.3125rem);
  --fs-xl: clamp(1.5rem, 1.3rem + 0.9vw, 1.75rem);
  --fs-2xl: clamp(1.75rem, 1.4rem + 1.8vw, 2.5rem);
  --fs-3xl: clamp(2.25rem, 1.6rem + 3.2vw, 3.5rem);

  /* Space */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  /* Shape and motion */
  --radius-pill: 999px;
  --radius-card: 12px;
  --ease-press: cubic-bezier(0.22, 1, 0.36, 1);
  --duration-press: 180ms;

  /* Measure */
  --max-width: 1040px;
  --max-width-text: 720px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-accent: #4DA3FF;
    --color-accent-pressed: #4DA3FF;   /* links stay at 6.5:1 on the dark canvas */
    --color-accent-hover-dark: #7CBBFF;
    --color-ink: #F2F2F3;
    --color-ink-secondary: rgba(242, 242, 243, 0.62);
    --color-divider: rgba(242, 242, 243, 0.16);
    --color-canvas: #1C1C1F;
    --color-surface: #2E2E30;
    --color-code-bg: rgba(242, 242, 243, 0.08);
    --color-mark: #F2F2F3;
    --color-mark-text: #1C1C1F;
  }
}

/* ------------------------------------------------------------------ base --- */

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.55;
  color: var(--color-ink);
  background: var(--color-canvas);
  margin: 0;
}

img { max-width: 100%; height: auto; display: block; }

::selection {
  background: var(--color-accent);
  color: #FFFFFF;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.15;
  color: var(--color-ink);
}

h1 { font-size: var(--fs-3xl); margin: 0 0 var(--space-5); }
h2 { font-size: var(--fs-2xl); margin: 0 0 var(--space-3); }
h3 { font-size: var(--fs-md); font-weight: 600; margin: 0 0 var(--space-2); line-height: 1.3; }

p { margin: 0 0 var(--space-4); }

ul, ol { padding-left: 1.25rem; margin: 0 0 var(--space-4); }
li { margin-bottom: var(--space-2); }

strong { font-weight: 600; }

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-code-bg);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

small, .text-xs { font-size: var(--fs-sm); }

.text-secondary, .muted { color: var(--color-ink-secondary); }

/* Mono is the utility face: labels, captions, technical detail. */
.mono {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  letter-spacing: 0.01em;
}

hr, .divider {
  border: none;
  border-top: 1px solid var(--color-divider);
  margin: var(--space-8) 0;
}

/* ----------------------------------------------------------------- links --- */

/* The signature, applied to every link: an ink bar wipes across the label and
   redacts it. A mark whose meaning is removal, used as the hover state. */
/* Link text uses the pressed accent, not the resting one: #007AFF on white is
   4.0:1, under the 4.5:1 AA floor for body text, while #0059BF is 6.6:1. Both
   are app tokens, so this stays inside the locked palette. The resting accent
   is still what fills the CTA, where it matches the app's button exactly. */
a {
  color: var(--color-accent-pressed);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  background-image: linear-gradient(var(--color-mark), var(--color-mark));
  background-repeat: no-repeat;
  background-size: 0% 100%;
  padding: 0 0.15em;
  margin: 0 -0.15em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: background-size var(--duration-press) var(--ease-press),
              color var(--duration-press) var(--ease-press);
}

a:hover,
a:focus-visible {
  color: var(--color-mark-text);
  background-size: 100% 100%;
  text-decoration-color: transparent;
}

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

/* ---------------------------------------------------------------- layout --- */

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.wrap.narrow { max-width: var(--max-width-text); }

section { padding: var(--space-9) 0; }
section:first-of-type { padding-top: var(--space-8); }
section.tight { padding-top: 0; }

/* Centred section heading, marked with a redaction bar rather than a rule. */
.section-title {
  text-align: center;
  max-width: 620px;
  margin: 0 auto var(--space-7);
}

.section-title h2::before {
  content: "";
  display: block;
  width: 36px;
  height: 7px;
  background: var(--color-mark);
  margin: 0 auto var(--space-4);
}

.section-title p {
  color: var(--color-ink-secondary);
  font-size: var(--fs-md);
  margin: var(--space-3) 0 0;
}

/* ---------------------------------------------------------------- header --- */

header.site {
  padding: var(--space-5) 0;
  border-bottom: 1px solid var(--color-divider);
}

header.site .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-4);
}

/* The app's own lockup. It's a greyscale+alpha PNG: the mark carries the ink,
   the ground is transparent, and the counters of "dact" are knocked out of the
   bar so they pick up the page behind them — which is what lets one file work
   on both themes. */
.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  background: none;
  padding: 0;
  margin: 0;
}

.brand img {
  height: 38px;
  width: auto;
  transition: opacity var(--duration-press) var(--ease-press),
              transform var(--duration-press) var(--ease-press);
}

.brand:hover img, .brand:focus-visible img { opacity: 0.7; }
.brand:active img { transform: scale(0.975); opacity: 0.78; }

@media (prefers-color-scheme: dark) {
  /* Inverts the colour channel only; alpha is untouched, so the knocked-out
     letters keep showing the dark page and the bar reads as light-on-dark. */
  .brand img { filter: invert(1); }
}

nav.primary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  font-size: var(--fs-sm);
}

nav.primary a {
  color: var(--color-ink-secondary);
  text-decoration: none;
}

nav.primary a[aria-current="page"] {
  color: var(--color-ink);
  background-size: 100% 2px;
  background-position: 0 100%;
}

/* --------------------------------------------------------------- buttons --- */

/* Pill CTA — shape, weight, and press match PIIPrimaryButtonStyle in the app. */
.btn-primary {
  display: inline-block;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--fs-base);
  line-height: 1.2;
  color: #FFFFFF;
  background: var(--color-accent);
  background-image: none;
  border: none;
  border-radius: var(--radius-pill);
  padding: 14px 30px;
  margin: 0;
  text-decoration: none;
  cursor: pointer;
  transform: scale(1);
  opacity: 1;
  transition: transform var(--duration-press) var(--ease-press),
              opacity var(--duration-press) var(--ease-press),
              background var(--duration-press) var(--ease-press);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--color-accent-pressed);
  color: #FFFFFF;
  text-decoration: none;
}

.btn-primary:active {
  transform: scale(0.975);
  opacity: 0.78;
}

/* The accent is lightened on a dark canvas, so a white label would fall to
   2.6:1. Ink on that same blue is 6.5:1, and the pill keeps its shape, weight
   and press behaviour. */
@media (prefers-color-scheme: dark) {
  .btn-primary { color: var(--color-dark-bg); }
  .btn-primary:hover,
  .btn-primary:focus-visible {
    background: var(--color-accent-hover-dark);
    color: var(--color-dark-bg);
  }
}

.btn-secondary {
  display: inline-block;
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
  background-image: linear-gradient(var(--color-mark), var(--color-mark));
  background-repeat: no-repeat;
  background-size: 0% 100%;
  padding: 0 0.15em;
  transition: background-size var(--duration-press) var(--ease-press),
              color var(--duration-press) var(--ease-press),
              transform var(--duration-press) var(--ease-press);
}

.btn-secondary:hover,
.btn-secondary:focus-visible { color: var(--color-mark-text); background-size: 100% 100%; }
.btn-secondary:active { transform: scale(0.975); opacity: 0.78; }

.cta-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.cta-row.left { align-items: flex-start; margin-bottom: var(--space-7); }

.cta-note {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--color-ink-secondary);
}

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

.hero {
  padding: var(--space-9) 0 var(--space-8);
  text-align: center;
}

.hero h1 {
  max-width: 16ch;
  margin-left: auto;
  margin-right: auto;
}

.hero .lede {
  font-size: var(--fs-lg);
  color: var(--color-ink-secondary);
  max-width: 54ch;
  margin: 0 auto var(--space-6);
}

/* The mark, as a headline treatment. Its resting state is redacted; on load the
   bar sweeps across and covers the words. Reduced motion lands on the same
   redacted state — nothing is ever revealed that shouldn't be. */
.redact-bar {
  display: inline;
  color: var(--color-mark-text);
  background-image: linear-gradient(var(--color-mark), var(--color-mark));
  background-repeat: no-repeat;
  background-size: 100% 100%;
  padding: 0 0.15em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  animation: redact-sweep 620ms var(--ease-press) 220ms backwards;
}

@keyframes redact-sweep {
  from { background-size: 0% 100%; }
  to   { background-size: 100% 100%; }
}

/* ------------------------------------------------------------ demo figure --- */

figure {
  margin: 0 0 var(--space-4);
}

figure img,
figure svg {
  width: 100%;
  height: auto;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-card);
  display: block;
}

figcaption {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--color-ink-secondary);
  margin-top: var(--space-3);
}

.demo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  align-items: start;
}

.demo-label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-ink-secondary);
  margin: 0 0 var(--space-2);
}

/* ---------------------------------------------------------- feature grid --- */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--space-6);
}

.feature {
  border-top: 1px solid var(--color-divider);
  padding-top: var(--space-5);
}

.feature p {
  margin: 0;
  color: var(--color-ink-secondary);
  font-size: var(--fs-sm);
}

/* ----------------------------------------------------------------- steps --- */

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-6);
  counter-reset: step;
  list-style: none;
  padding: 0;
}

.step {
  position: relative;
  padding-left: 46px;
  margin: 0;
}

.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 2px;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--color-mark-text);
  background: var(--color-mark);
  padding: 2px 6px;
}

.step p {
  margin: 0;
  color: var(--color-ink-secondary);
  font-size: var(--fs-sm);
}

/* ------------------------------------------------------------- scenarios --- */

.scenarios {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: var(--max-width-text);
}

.scenarios li {
  border-top: 1px solid var(--color-divider);
  padding: var(--space-5) 0;
  margin: 0;
}

.scenarios li:last-child { border-bottom: 1px solid var(--color-divider); }

.scenarios h3 { margin-bottom: var(--space-2); }
.scenarios p { margin: 0; color: var(--color-ink-secondary); }

/* ------------------------------------------------------------- objection --- */

.objection {
  max-width: var(--max-width-text);
  margin: 0 auto;
}

.objection h2 {
  font-size: var(--fs-xl);
  margin-bottom: var(--space-4);
}

/* ----------------------------------------------------------- dark section --- */

.section-dark {
  background: var(--color-dark-bg);
  color: #FFFFFF;
}

.section-dark h2,
.section-dark h3 { color: #FFFFFF; }

.section-dark .section-title p,
.section-dark p { color: rgba(255, 255, 255, 0.62); }

.section-dark .section-title h2::before { background: #FFFFFF; }

.section-dark a { color: #6EB4FF; }
.section-dark a:hover,
.section-dark a:focus-visible { color: var(--color-dark-bg); background-image: linear-gradient(#FFFFFF, #FFFFFF); }

.section-dark :focus-visible { outline-color: #6EB4FF; }

.proof-list {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 680px;
  display: grid;
  gap: var(--space-4);
}

.proof-list li {
  background: var(--color-dark-raised);
  border-radius: var(--radius-card);
  padding: var(--space-5);
  margin: 0;
}

.proof-list strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-md);
  margin-bottom: var(--space-1);
}

.proof-list span,
.proof-list p {
  display: block;
  color: rgba(255, 255, 255, 0.62);
  font-size: var(--fs-sm);
  margin: 0;
}

@media (prefers-color-scheme: dark) {
  .section-dark { background: var(--color-dark-raised); }
  .proof-list li { background: var(--color-dark-bg); }
}

/* A short paragraph carrying technical detail under a grid or list. */
.note {
  max-width: var(--max-width-text);
  margin: var(--space-7) auto 0;
  color: var(--color-ink-secondary);
  font-size: var(--fs-sm);
}

.section-action {
  text-align: center;
  margin: var(--space-7) 0 0;
}

/* ---------------------------------------------------------------- limits --- */

/* "What it can't do." The most distinctive thing on the site — set plainly,
   not as a warning box. */
.limits {
  max-width: var(--max-width-text);
  margin: 0 auto;
}

.limits ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.limits li {
  border-top: 1px solid var(--color-divider);
  padding: var(--space-3) 0 var(--space-3) var(--space-6);
  margin: 0;
  position: relative;
}

.limits li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.05em;
  width: 18px;
  height: 6px;
  background: var(--color-mark);
}

.limits li:last-child { border-bottom: 1px solid var(--color-divider); }

.limits-note { margin: var(--space-5) 0 0; color: var(--color-ink-secondary); font-size: var(--fs-sm); }

/* --------------------------------------------------------------- pricing --- */

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-5);
  max-width: 760px;
  margin: 0 auto var(--space-7);
}

.plan {
  border: 1px solid var(--color-divider);
  border-radius: 16px;
  padding: var(--space-6);
}

.plan.plan-pro { border-color: var(--color-ink); }

.plan h3 { font-size: var(--fs-lg); margin-bottom: var(--space-1); }

.plan .price {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 700;
  margin: var(--space-2) 0 var(--space-4);
}

.plan .price small {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 400;
  color: var(--color-ink-secondary);
  display: block;
}

.plan ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--color-ink-secondary);
  font-size: var(--fs-sm);
}

/* ------------------------------------------------------ prose components --- */

/* Pages that are meant to be read densely: /faq, /privacy, /support, the
   guides. Same system, narrower measure, left-aligned headings. */
.prose { max-width: var(--max-width-text); }
.prose h2 {
  font-size: var(--fs-xl);
  margin: var(--space-8) 0 var(--space-3);
  padding-top: var(--space-4);
  position: relative;
}

.prose h2::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 36px;
  height: 7px;
  background: var(--color-mark);
}

.prose h1 { font-size: var(--fs-2xl); }
.prose h3 { margin: var(--space-6) 0 var(--space-2); }

/* Wide comparison tables break out of the reading measure rather than being
   squeezed into it. */
.prose .table-scroll {
  --bleed: min(var(--max-width), calc(100vw - 2 * var(--space-5)));
  width: var(--bleed);
  margin-left: calc((var(--bleed) - 100%) / -2);
}

.prose > p:first-of-type + h2 { margin-top: var(--space-7); }

.lede {
  font-size: var(--fs-md);
  color: var(--color-ink);
  margin-bottom: var(--space-6);
}

.byline, .last-updated {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--color-ink-secondary);
}

.byline { margin: 0 0 var(--space-6); }

.summary {
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-card);
  padding: var(--space-5);
  margin: 0 0 var(--space-7);
}

.summary p:first-child { margin-top: 0; }
.summary > :last-child { margin-bottom: 0; }
.summary ul { margin: 0; padding-left: 1.2rem; }

main { padding-bottom: var(--space-8); }
main > .wrap { padding-top: var(--space-8); }

/* ---------------------------------------------------------------- tables --- */

table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-5) 0 var(--space-7);
  font-size: var(--fs-sm);
}

caption {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  text-align: left;
  color: var(--color-ink-secondary);
  margin-bottom: var(--space-3);
}

th, td {
  text-align: left;
  padding: var(--space-3);
  border: 1px solid var(--color-divider);
  vertical-align: top;
}

th {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.table-scroll { overflow-x: auto; margin: var(--space-5) 0 var(--space-7); }
.table-scroll table { margin: 0; }

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

footer.site {
  border-top: 1px solid var(--color-divider);
  padding: var(--space-7) 0;
  font-size: var(--fs-sm);
  color: var(--color-ink-secondary);
}

.footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-divider);
}

footer.site nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
}

footer.site nav a { color: var(--color-ink-secondary); text-decoration: none; }
footer.site p { margin: 0; }

/* ------------------------------------------------------------ responsive --- */

@media (max-width: 720px) {
  section { padding: var(--space-8) 0; }
  .hero { padding: var(--space-8) 0 var(--space-7); }
  .demo { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .wrap { padding: 0 var(--space-4); }
  .btn-primary { padding: 14px 24px; }
}

/* -------------------------------------------------------- reduced motion --- */

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

  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  /* The bar's resolved state is redacted. With motion off it is simply already
     there — the words are never shown uncovered. */
  .redact-bar { background-size: 100% 100%; animation: none; }
}

/* --------------------------------------------------------------- printing --- */

@media print {
  header.site nav, footer.site nav, .btn-primary { display: none; }
  a { color: inherit; background: none; }
  .section-dark { background: none; color: inherit; }
  .section-dark h2, .section-dark h3, .section-dark p { color: inherit; }
}
