/*
 * Can I Format? — the website. Colours, type and chrome are the app's own, so
 * the site and the program read as one thing.
 */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dfe3e8;
  --border-strong: #c5ccd4;
  --text: #14181d;
  --text-dim: #5c6773;
  --text-faint: #8a94a0;

  --accent: #2a6df4;
  --accent-text: #ffffff;

  --safe: #17803d;
  --safe-bg: #e8f6ed;
  --safe-border: #a8dcbc;

  --danger: #c02626;
  --danger-bg: #fdecec;
  --danger-border: #f2b8b8;

  --warn: #9a6200;
  --warn-bg: #fdf3e2;
  --warn-border: #ecd0a1;

  --radius: 10px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171b;
    --surface: #1b1f25;
    --surface-2: #22272e;
    --border: #2c333c;
    --border-strong: #3d4652;
    --text: #e7ebf0;
    --text-dim: #a2adba;
    --text-faint: #717d8b;

    --accent: #5b91ff;
    --accent-text: #0d1117;

    --safe: #58d68d;
    --safe-bg: #14291d;
    --safe-border: #2b6b45;

    --danger: #ff8080;
    --danger-bg: #2e1718;
    --danger-border: #7a3535;

    --warn: #e0b062;
    --warn-bg: #2c2415;
    --warn-border: #6d5628;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}
h1 {
  font-size: 1.05rem;
}
h2 {
  font-size: 1rem;
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--surface-2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* ---- chrome ------------------------------------------------------------ */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: inherit;
  text-decoration: none;
}

.topbar-link {
  font-size: 0.875rem;
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
}
.topbar-link:hover {
  background: var(--surface-2);
  color: var(--text);
}
.brand-mark {
  font-size: 1.2rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.safety-note {
  font-size: 0.8rem;
  color: var(--text-faint);
}

main {
  max-width: 980px;
  margin: 0 auto;
  padding: 1.25rem;
}

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

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

a {
  color: var(--accent);
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  font-weight: 550;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  padding: 0.6rem 1.1rem;
  text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease, filter 0.12s ease;
}
.button:hover {
  background: var(--surface-2);
}
.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.button.primary:hover {
  filter: brightness(1.08);
}

.topbar .button {
  font-size: 0.875rem;
  padding: 0.4rem 0.85rem;
}

.site main {
  max-width: 1080px;
  padding: 0 1.25rem;
}

.eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.6rem;
}

/* ---- landing: hero ------------------------------------------------------ */

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 3rem;
  align-items: center;
  padding: 4.5rem 0 3.5rem;
}
.landing-hero h2 {
  font-size: clamp(2rem, 4.4vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin-bottom: 1rem;
  text-wrap: balance;
}
.landing-hero .lede {
  font-size: 1.1rem;
  color: var(--text-dim);
  max-width: 50ch;
  margin: 0 0 1.75rem;
}
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}
.reassure {
  margin: 1.25rem 0 0;
  font-size: 0.85rem;
  color: var(--text-faint);
}

/* A verdict as the app draws one — static, but the real thing's shape. */
.demo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem;
  box-shadow: 0 18px 40px -24px rgb(0 0 0 / 0.35);
}
.demo-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.demo-head strong {
  color: var(--text);
  font-size: 0.95rem;
}
.demo-verdict {
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin-bottom: 0.7rem;
  border: 1px solid var(--danger-border);
  background: var(--danger-bg);
}
.demo-verdict.safe {
  border-color: var(--safe-border);
  background: var(--safe-bg);
}
.demo-verdict b {
  display: block;
  font-size: 1.1rem;
  color: var(--danger);
}
.demo-verdict.safe b {
  color: var(--safe);
}
.demo-verdict span {
  font-size: 0.85rem;
  color: var(--text-dim);
}
.demo-gaps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}
.demo-gaps li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.85rem;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  background: var(--surface-2);
}
.demo-gaps .count {
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  white-space: nowrap;
}
.demo-arrow {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-faint);
  margin: 0.8rem 0;
}

/* ---- landing: sections -------------------------------------------------- */

.band {
  padding: 3.5rem 0;
  border-top: 1px solid var(--border);
}
.band > h2 {
  font-size: clamp(1.4rem, 2.6vw, 1.85rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.6rem;
  text-wrap: balance;
}
.band > .intro {
  color: var(--text-dim);
  max-width: 62ch;
  margin: 0 0 2rem;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  counter-reset: step;
}
.steps li {
  counter-increment: step;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.steps li::before {
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 650;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}
.steps h3,
.features h3,
.promises h3 {
  font-size: 1rem;
  margin-bottom: 0.35rem;
}
.steps p,
.features p,
.promises p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.92rem;
}

.promises {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.promises > div {
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--safe-border);
  background: var(--safe-bg);
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.features a {
  display: block;
  color: inherit;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  transition: border-color 0.12s ease;
}
.features a:hover {
  border-color: var(--accent);
}
.features .more {
  display: inline-block;
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: var(--accent);
}

.closing {
  text-align: center;
  padding: 3.5rem 0 4rem;
  border-top: 1px solid var(--border);
}
.closing h2 {
  font-size: clamp(1.4rem, 2.6vw, 1.85rem);
  margin-bottom: 0.6rem;
}
.closing p {
  color: var(--text-dim);
  margin: 0 auto 1.5rem;
  max-width: 52ch;
}
.closing .cta-row {
  justify-content: center;
}

.site-foot {
  border-top: 1px solid var(--border);
  padding: 1.5rem 1.25rem 2rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-faint);
}
.site-foot p {
  margin: 0.25rem 0;
}
.site-foot a {
  color: var(--text-dim);
}

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

.guide {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 3rem;
  padding: 2.5rem 0 4rem;
}

.toc {
  position: sticky;
  top: 4.5rem;
  align-self: start;
  max-height: calc(100vh - 5.5rem);
  overflow-y: auto;
  font-size: 0.88rem;
}
.toc p {
  margin: 0 0 0.5rem;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
.toc a {
  display: block;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  color: var(--text-dim);
  text-decoration: none;
  border-left: 2px solid transparent;
}
.toc a:hover {
  color: var(--text);
  background: var(--surface-2);
}
.toc a[aria-current="true"] {
  color: var(--accent);
  border-left-color: var(--accent);
  border-radius: 0 6px 6px 0;
}
/* The page being read. Its own sections open beneath it. */
.toc a[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
}
/* Pages and a page's own sections have to read as two different things:
   pages at full strength, sections smaller and dimmer, hung off a guide line
   so they are plainly inside the page above them. */
.toc > ol > li > a {
  color: var(--text);
}
.toc .toc-sub {
  margin: 0.2rem 0 0.6rem 1.4rem;
  border-left: 1px solid var(--border-strong);
  font-size: 0.82rem;
}
.toc-sub a {
  color: var(--text-faint);
  padding: 0.22rem 0.7rem;
  border-radius: 0 6px 6px 0;
  /* Over the guide line, so the section being read lights up a stretch of it. */
  margin-left: -1px;
}

/* Previous and next page, at the foot of every docs page. */
.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.pager a {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  font-weight: 600;
  min-width: 0;
}
.pager a:hover {
  border-color: var(--accent);
}
.pager span {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-faint);
}
.pager .next {
  margin-left: auto;
  text-align: right;
}

.docs-index {
  margin-top: 1.5rem;
}

.prose {
  max-width: 72ch;
}
.prose > header {
  margin-bottom: 2.5rem;
}
.prose > header h2 {
  font-size: clamp(1.8rem, 3.6vw, 2.4rem);
  letter-spacing: -0.025em;
  margin-bottom: 0.6rem;
}
.prose > header p {
  font-size: 1.05rem;
  color: var(--text-dim);
  margin: 0;
}
.prose section {
  padding-top: 1rem;
  margin-bottom: 2.25rem;
  scroll-margin-top: 4rem;
}
.prose section + section {
  border-top: 1px solid var(--border);
  padding-top: 2.25rem;
}
.prose h3 {
  font-size: 1.35rem;
  letter-spacing: -0.015em;
  margin-bottom: 0.75rem;
}
.prose h4 {
  font-size: 1rem;
  margin: 1.5rem 0 0.4rem;
}
.prose p,
.prose li {
  color: var(--text);
}
.prose p {
  margin: 0 0 0.9rem;
}
.prose ul,
.prose ol {
  margin: 0 0 1rem;
  padding-left: 1.3rem;
}
.prose li {
  margin-bottom: 0.4rem;
}
.prose pre {
  font-family: var(--mono);
  font-size: 0.85rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  overflow-x: auto;
  margin: 0 0 1rem;
}
.prose pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

.table-wrap {
  overflow-x: auto;
  margin: 0 0 1rem;
}
.prose table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
}
.prose th,
.prose td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--border);
}
.prose th {
  font-weight: 600;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.callout {
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin: 0 0 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
}
.callout.safe {
  border-color: var(--safe-border);
  background: var(--safe-bg);
}
.callout.warn {
  border-color: var(--warn-border);
  background: var(--warn-bg);
}
.callout p:last-child {
  margin-bottom: 0;
}

kbd,
.ui {
  font-family: var(--sans);
  font-size: 0.86em;
  font-weight: 600;
  padding: 0.05em 0.4em;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  white-space: nowrap;
}

/* ---- narrow screens ----------------------------------------------------- */

/* Four steps across stop fitting well before a phone does. */
@media (max-width: 1060px) {
  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .landing-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
    padding: 2.75rem 0 2.5rem;
  }
  .steps,
  .promises {
    grid-template-columns: minmax(0, 1fr);
  }
  .guide {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    padding-top: 1.5rem;
  }
  .toc {
    position: static;
    max-height: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 0.85rem;
  }
  .toc > ol {
    columns: 2;
    column-gap: 0.5rem;
  }
  /* Above the page rather than beside it, so the page's own sections would
     only push the page itself further down. */
  .toc-sub {
    display: none;
  }
}

@media (max-width: 560px) {
  .site main {
    padding: 0 16px;
  }
  .topbar {
    padding: 0.65rem 16px;
  }
  .topbar .safety-note {
    display: none;
  }
  /* The name, one short link and Download fit at phone width; a second link
     wrapped the name. Source is the one that goes, since every page links to
     it from its content, and the way to Docs or Home stays. */
  .topbar .topbar-link.optional {
    display: none;
  }
  .topbar-right {
    gap: 0.25rem;
  }
  .brand h1 {
    white-space: nowrap;
  }
  .toc > ol {
    columns: 1;
  }
}

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

/* Unlinked on purpose: it exists for whoever goes looking for it. */
.pricing {
  padding: 4rem 0;
}

/* Who made it, in two rows that line up across the page: the photo with the
   name beside it, sitting on its bottom edge; then the links with the words
   beside them, starting level. */
.about {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  grid-template-areas:
    "photo intro"
    "links text";
  column-gap: 3rem;
  row-gap: 1.5rem;
  align-items: start;
  max-width: 820px;
  margin: 0 auto;
  padding: 3rem 0;
}
/* Cropped to a circle by the browser, so the file stays a plain square. */
.avatar {
  grid-area: photo;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}
.socials {
  grid-area: links;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.1rem;
}
.socials a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.92rem;
}
.socials a:hover {
  color: var(--accent);
}
.socials svg {
  flex: none;
}
.about-intro {
  grid-area: intro;
  align-self: end;
}
.about-intro .eyebrow {
  margin-bottom: 0.3rem;
}
.about-intro h2 {
  font-size: 2.2rem;
  letter-spacing: -0.025em;
}
.about-text {
  grid-area: text;
  /* The links carry this much padding above each one; matching it puts the
     first line of text level with the first link. */
  padding-top: 0.3rem;
}
.about-text p:first-child {
  margin-top: 0;
}

/* One column: photo, then who and what, then where else to find me. */
@media (max-width: 760px) {
  .about {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "photo"
      "intro"
      "text"
      "links";
    row-gap: 1.5rem;
    padding: 2.5rem 0;
  }
  .avatar {
    width: 112px;
    height: 112px;
  }
  .about-intro h2 {
    font-size: 1.8rem;
  }
}

/* The narrowest phones: the name, one link and Download only fit once the
   icon goes and the controls tighten up. */
@media (max-width: 360px) {
  .topbar .brand-mark {
    display: none;
  }
  .topbar .topbar-link {
    padding: 0.4rem 0.45rem;
  }
  .topbar .button {
    padding: 0.4rem 0.65rem;
  }
}
