/*
  Kredo website styles.

  Two page types share this sheet:

    * the legal documents (/privacy, /terms) -- an editorial document layout.
      Typography and hairline rules do the work here; there are no cards, no
      fills, and no shadows. Someone arriving from Google OAuth verification,
      App Review or a privacy question should read a document, not a UI.
    * the homepage, which keeps a light card treatment for its feature grid.

  Kredo purple is an ACCENT ONLY -- links, hover, and the section rule. The
  brand mark carries the identity; the page does not need to.

  Neutrals are cool-tinted to sit with the app's palette (Kredo/Theme.swift)
  without borrowing its surface colours, which are built for a card UI.

  No JavaScript anywhere on this site: the legal pages must be readable with
  scripting disabled, which is also what a policy reviewer will do.
*/

:root {
  --page: #ffffff;
  --page-alt: #fbfbfc;
  --rule: #e6e7ec;
  --rule-strong: #d5d7de;

  --ink: #16171f;          /* body + headings; 15.9:1 on white   */
  --ink-2: #545a66;        /* secondary prose;  7.4:1 on white   */
  --ink-3: #6f757f;        /* metadata, labels; 5.2:1 on white   */

  /* Darker than the app's #7C4DFF so link text clears WCAG AA on white.
     The brand purple survives untouched in the logo. */
  --accent: #6633ea;
  --accent-hover: #4f21c9;

  --doc: 50rem;            /* ~800px reading column */
  --site: 68rem;
  --header-h: 68px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #101116;
    --page-alt: #16171d;
    --rule: #262832;
    --rule-strong: #333642;
    --ink: #e9ebf1;
    --ink-2: #a4aab8;
    --ink-3: #878d9b;
    --accent: #a88bff;
    --accent-hover: #c0aaff;
  }
}

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

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

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

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

.wrap {
  width: 100%;
  max-width: var(--site);
  margin: 0 auto;
  padding: 0 24px;
}

/* =========================================================
   Header — compact, sticky, one hairline. No shadow, no fill.
   ========================================================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: var(--page);
  border-bottom: 1px solid var(--rule);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 620;
  font-size: 1.0625rem;
  letter-spacing: -0.011em;
}

/* The app's own K mark (Assets.xcassets/applogo.imageset), transparent, so it
   sits on both the light and dark page backgrounds without a plate behind it.
   Height is the fixed dimension and width follows the 1312:1199 aspect. */
.brand-mark {
  height: 22px;
  width: auto;
  display: block;
}

/* Walkie's app icon: a full-bleed square tile, so it gets the icon's rounded corners. */
.brand-mark--app {
  height: 28px;
  width: 28px;
  border-radius: 7px;
}

.header-nav {
  display: flex;
  gap: 24px;
  font-size: 0.9375rem;
}

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

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

.header-nav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 560;
}

/* =========================================================
   Legal document
   ========================================================= */

.doc {
  max-width: var(--doc);
  margin: 0 auto;
  padding: 64px 0 96px;
}

.back-home {
  display: inline-block;
  margin-bottom: 38px;
  color: var(--ink-3);
  text-decoration: none;
  font-size: 0.875rem;
  letter-spacing: 0.002em;
}

.back-home:hover { color: var(--ink-2); }

.doc h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 1.35rem + 2.6vw, 2.875rem);
  font-weight: 650;
  line-height: 1.14;
  letter-spacing: -0.024em;
}

.updated {
  margin: 0;
  color: var(--ink-3);
  font-size: 0.9375rem;
}

/* Introduction: prose on the page, no container. */
.doc > .lede {
  margin: 32px 0 0;
  font-size: 1.0625rem;
  color: var(--ink-2);
}

.doc > .lede + .lede { margin-top: 16px; }

/* ---------- Table of contents ---------- */

.toc {
  margin: 46px 0 0;
  padding: 22px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

/* Scoped under .doc so it outranks the `.doc h2` section-heading rule --
   this h2 labels the nav landmark, it is not a document section. */
.doc .toc-title {
  margin: 0 0 14px;
  font-size: 0.75rem;
  font-weight: 620;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-3);
}

.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
  font-size: 0.9375rem;
  columns: 2;
  column-gap: 44px;
}

.toc li {
  counter-increment: toc;
  margin: 0 0 7px;
  break-inside: avoid;
  display: flex;
  gap: 12px;
}

.toc li::before {
  content: counter(toc, decimal-leading-zero);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
  line-height: 1.75;
  flex: none;
}

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

.toc a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.doc section { padding-top: 0; }

.doc section:first-of-type { margin-top: 54px; }

.doc section + section {
  margin-top: 32px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
}

.doc h2 {
  margin: 0 0 18px;
  font-size: 1.625rem;
  font-weight: 630;
  line-height: 1.28;
  letter-spacing: -0.017em;
  scroll-margin-top: calc(var(--header-h) + 24px);
}

.doc h2 .num {
  display: block;
  margin-bottom: 7px;
  font-size: 0.75rem;
  font-weight: 620;
  letter-spacing: 0.09em;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.doc h3 {
  margin: 30px 0 10px;
  font-size: 1.125rem;
  font-weight: 620;
  letter-spacing: -0.008em;
  scroll-margin-top: calc(var(--header-h) + 24px);
}

.doc p {
  margin: 0 0 18px;
  color: var(--ink);
}

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

.doc ul,
.doc ol.list {
  margin: 0 0 18px;
  padding-left: 1.3rem;
}

.doc li { margin-bottom: 9px; }

.doc li:last-child { margin-bottom: 0; }

.doc li::marker { color: var(--ink-3); }

.doc strong { font-weight: 620; }

.doc code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.875em;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.doc a {
  overflow-wrap: anywhere;
  text-underline-offset: 2px;
}

/* ---------- Emphasis blocks ----------
   A rule and weight, not a tinted box. These carry the statements a reader
   must not miss (what Kredo never asks for, verify with your issuer), so they
   need to stand out without becoming UI. */

.callout {
  margin: 0 0 20px;
  padding: 2px 0 2px 20px;
  border-left: 2px solid var(--accent);
}

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


/* ---------- Tables ---------- */

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.table-scroll table { min-width: 32rem; }

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

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

th {
  border-bottom-color: var(--rule-strong);
  color: var(--ink-3);
  font-size: 0.75rem;
  font-weight: 620;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

td { color: var(--ink-2); }

td strong { color: var(--ink); }

/* =========================================================
   Homepage
   ========================================================= */

.hero {
  max-width: var(--doc);
  margin: 0 auto;
  padding: 88px 0 44px;
}

.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(2.1rem, 1.4rem + 2.9vw, 3rem);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.028em;
}

.hero .lede {
  margin: 0;
  max-width: 34rem;
  font-size: 1.125rem;
  color: var(--ink-2);
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1px;
  background: var(--rule);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin: 24px 0 88px;
}

.feature {
  background: var(--page);
  padding: 28px 28px 30px;
}

.feature h3 {
  margin: 0 0 8px;
  font-size: 1.0625rem;
  font-weight: 620;
  letter-spacing: -0.01em;
}

.feature p {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.9375rem;
}

/* =========================================================
   Footer
   ========================================================= */

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 30px 0 40px;
  font-size: 0.875rem;
  color: var(--ink-3);
}

.footer-inner {
  max-width: var(--doc);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 24px;
}

.site-footer .wrap { max-width: var(--site); }

.footer-brand {
  margin: 0;
  color: var(--ink);
  font-weight: 620;
}

.footer-nav {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.footer-nav li + li::before {
  content: "·";
  margin: 0 9px;
  color: var(--rule-strong);
}

.footer-nav li { display: flex; }

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

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

.footer-copy {
  margin: 0;
  margin-left: auto;
}

.footer-note {
  max-width: var(--doc);
  margin: 18px auto 0;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--ink-3);
}

/* =========================================================
   Mobile
   ========================================================= */

@media (max-width: 46rem) {
  :root { --header-h: 60px; }

  body { font-size: 16px; }

  .wrap { padding: 0 22px; }

  .doc { padding: 40px 0 64px; }

  .back-home { margin-bottom: 28px; }

  .doc > .lede { margin-top: 26px; font-size: 1rem; }

  .toc { margin-top: 38px; }

  .toc ol { columns: 1; }

  .doc section:first-of-type { margin-top: 42px; }

  .doc section + section {
    margin-top: 28px;
    padding-top: 28px;
  }

  .doc h2 { font-size: 1.4375rem; }

  .doc h3 { margin-top: 26px; font-size: 1.0625rem; }

  .header-nav { gap: 18px; font-size: 0.875rem; }

  .hero { padding: 52px 0 32px; }

  .features { margin-bottom: 56px; }

  .feature { padding: 24px 22px 26px; }

  .footer-copy { margin-left: 0; width: 100%; }
}

@media (max-width: 26rem) {
  .brand span { font-size: 1rem; }
  .header-nav { gap: 14px; }
}
