/*
  smll.ai: the one shared stylesheet. Every page links it; no page has inline styles.
  Vocabulary is CONTEXT.md's. Sizes are spec #52's "Visual system" (wide = mockup pt x 2).

  Sections, in order. Add to the section a rule belongs to; give a new page or component
  its own section before "Narrow", and put its narrow rules in the Narrow section.
    1. Tokens          palette, faces, type scale, layout sizes (the only place colours are written)
    2. Base            element defaults, chalk text shadow
    3. Focus and hover the keyboard focus outline; every hover rule, for pointers that hover
    4. Frame           the page column; the footer follows the content
    5. Site header     logo mark, wordmark, tabs, blog label, contact us
    6. Site footer     copyright, privacy, cookie settings (added by analytics.js)
    7. Buttons         the lime-outlined call to action
    8. Shared          the lede under a page's heading; visually hidden text
    9. Page: home
   10. Page: not-found
   11. Page: privacy   long prose at a 38em measure, the cookies table on Board raised
   12. Page: contact   heading, "open the contact form"
   13. Page: about
   14. Consent banner  the strip analytics.js docks to the bottom until it is answered
   15. Narrow          everything that changes at <= 920 px
*/

/* ==================================================================== 1. Tokens */

:root {
  /* grounds */
  --board: #2B2C2A;
  --raised: #444642;

  /* chalk on the Board, brightest to faintest. Annotation is never used for text. */
  --chalk-1: #E8E8E4;
  --chalk-2: #B1B2AE;
  --chalk-3: #868884;
  /* chalk on Board raised */
  --raised-chalk-1: #F2F2EE;
  --raised-chalk-2: #CECFCB;
  --raised-chalk-3: #AEAFAB;

  /* accent: lime on the Board / on Board raised, its secondary strengths, and hover lime
     (hover and the keyboard focus outline only) */
  --lime: #C4D97C;
  --raised-lime: #CFE087;
  --lime-2: #8C9E4F;
  --raised-lime-2: #9EB05F;
  --hover-lime: #E0EE9F;

  /* chalk text blooms: a 1.2 px same-colour shadow at 45 % */
  --bloom: 0 0 1.2px color-mix(in srgb, currentColor 45%, transparent);

  /* the consent banner's shadow, cast up onto the page */
  --shadow: rgb(0 0 0 / .3);

  /* faces: self-hosted (below), each followed by its metric-matched fallback */
  --prose: "Cabin", "Cabin fallback", Arial, sans-serif;
  --mono: "Inconsolata", Consolas, "Inconsolata fallback", ui-monospace, monospace;

  /* wide type scale */
  --h1: 32px;   --h1-lh: 40px;
  --body: 20px; --body-lh: 24px;
  --ui: 13.5px;               /* site header, buttons, site footer (mono) */

  /* layout */
  --column: 880px;            /* the content column at 1440 */
  --margin: 0px;              /* page margin outside the column (narrow only) */
  --inset: 12px;              /* text inset from the column's rules */
  --column-width: min(var(--column), 100% - 2 * var(--margin));  /* frame and banner */
  --cell-h: 33px;             /* site header cell height, as drawn */
  --cell-w: 84px;             /* home, about and blog cells */
  --tap-h: 44px;              /* every site header link's tap area, at every width */
}

/* Self-hosted faces (OFL; licences in /fonts/). Every page preloads both files, so these
   are the site's only two font requests. Rebuild them with scripts/build-fonts. */
@font-face {
  font-family: "Cabin";
  src: url("/fonts/cabin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

/* Cabin has no → (U+2192): draw its arrows from the Inconsolata file already loaded,
   so the flow line's arrows stay in a web font with no third request. */
@font-face {
  font-family: "Cabin";
  src: url("/fonts/inconsolata.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+2192;
}

@font-face {
  font-family: "Inconsolata";
  src: url("/fonts/inconsolata.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  size-adjust: 108%;
}

/* Metric-matched fallbacks, shown until the web fonts arrive, so text appears at once and
   barely moves on the swap. Vertical overrides are Cabin's and Inconsolata's own metrics,
   divided by the size-adjust they are scaled by. */
@font-face {
  font-family: "Cabin fallback";
  src: local("Arial"), local("ArialMT"), local("Liberation Sans"), local("LiberationSans"), local("Helvetica");
  font-weight: 400;
  size-adjust: 95%;
  ascent-override: 101.6%;
  descent-override: 26.3%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Cabin fallback";
  src: local("Arial Bold"), local("Arial-BoldMT"), local("Liberation Sans Bold"), local("LiberationSans-Bold"), local("Helvetica Bold");
  font-weight: 700;
  size-adjust: 90%;
  ascent-override: 107.2%;
  descent-override: 27.8%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Inconsolata fallback";
  src: local("Menlo"), local("Menlo-Regular"), local("DejaVu Sans Mono"), local("DejaVuSansMono"), local("Liberation Mono"), local("LiberationMono"), local("Courier New");
  size-adjust: 90%;
  ascent-override: 103.1%;
  descent-override: 22.8%;
  line-gap-override: 0%;
}

/* ====================================================================== 2. Base */

* { box-sizing: border-box; }

html {
  background: var(--board);
  color-scheme: dark;
}

body {
  margin: 0;
  background: var(--board);
  color: var(--chalk-1);
  font-family: var(--prose);
  -webkit-font-smoothing: antialiased;
  text-shadow: var(--bloom);
}

a { color: inherit; }

h1 {
  margin: 0;
  font-size: var(--h1);
  line-height: var(--h1-lh);
  font-weight: 400;
}

hr {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--chalk-2);
}

/* =========================================================== 3. Focus and hover */

/* Keyboard focus only: mouse clicks show nothing. Offset outside the element, on both
   grounds and at every width. */
:focus-visible {
  outline: 2px solid var(--hover-lime);
  outline-offset: 2px;
}

/* Every hover rule, only where there is a pointer that hovers: phones have no hover. */
@media (hover: hover) {
  /* home and about: an outline of the same square cell */
  a.tab:hover {
    outline: 1.5px solid var(--hover-lime);
    outline-offset: -1.5px;
  }

  /* the outlined buttons brighten their outline and text */
  .contact-tab:hover,
  .button:hover {
    border-color: var(--hover-lime);
    color: var(--hover-lime);
  }

  .contact-tab[aria-current="page"]:hover { color: var(--board); }

  /* text links brighten to hover lime; underlined ones take their underline with them */
  .site-footer a:hover,
  .smll-cookie-settings:hover,
  .smll-consent p a:hover { color: var(--hover-lime); }

  .chart figcaption a:hover,
  .privacy a:hover {
    color: var(--hover-lime);
    text-decoration-color: currentColor;
  }

  /* the consent banner's choices brighten within Board raised chalk, never to lime */
  .smll-consent-choice:hover { border-color: var(--raised-chalk-1); }
}

/* ===================================================================== 4. Frame */

/* Header, main and footer stacked in the content column. The footer follows the
   content, even on short pages: no min-height, no sticky footer. */
.frame {
  width: var(--column-width);
  margin: 0 auto;
}

main { padding: 50px var(--inset) 80px; }

/* =============================================================== 5. Site header */

.site-header { padding-top: 30px; }

.site-header hr { margin-top: 8px; }

.site-nav {
  display: flex;
  align-items: center;
  height: var(--cell-h);
  font-family: var(--mono);
  font-size: var(--ui);
}

.site-nav ul {
  display: flex;
  align-items: center;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav li { height: 100%; }

/* logo mark and wordmark: one link home */
.brand {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 12px;
  height: 100%;
  padding-left: var(--inset);
  color: var(--chalk-1);
  text-decoration: none;
}

.logo-mark {
  flex: none;
  width: 24px;
  height: 25px;
}

.divider {
  flex: none;
  width: 1px;
  height: 30px;
  margin: 0 16px 0 18px;
  background: var(--chalk-2);
}

/* home, about and blog: equal square cells, edge to edge */
.tab {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: var(--cell-w);
  height: 100%;
  color: var(--chalk-1);
  text-decoration: none;
}

/* the current page fills its cell in lime with dark text */
.tab[aria-current="page"],
.contact-tab[aria-current="page"] {
  background: var(--lime);
  color: var(--board);
  text-shadow: none;
}

/* blog: a label, not a link. Secondary chalk, because annotation chalk fails AA. */
.tab.blog {
  color: var(--chalk-2);
  line-height: 1;
  cursor: default;
}

.tab.blog small {
  margin-top: 2px;
  font-size: 7px;
  letter-spacing: .02em;
}

/* contact us: the outlined call to action, no arrow at any width. On the contact page
   it becomes a filled square tab like home and about. */
.contact-tab {
  display: inline-flex;
  align-items: center;
  height: 100%;
  margin-left: 8px;
  padding: 0 14px;
  border: 1.5px solid var(--lime);
  border-radius: 6px;
  color: var(--lime);
  text-decoration: none;
}

.contact-tab[aria-current="page"] {
  justify-content: center;
  width: 116px;
  padding: 0;
  border-radius: 0;
}

/* Every link keeps a --tap-h tall tap area at every width without changing its look: an
   invisible box centred on the link, taller than the link where the link is shorter. */
.site-nav a { position: relative; }

.site-nav a::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: max(100%, var(--tap-h));
  transform: translateY(-50%);
}

/* =============================================================== 6. Site footer */

.site-footer {
  padding-bottom: 30px;
  font-family: var(--mono);
  font-size: var(--ui);
  color: var(--chalk-2);
}

.site-footer .row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px 48px;
  padding: 20px var(--inset) 0;
}

.site-footer a { text-decoration: none; }

/* "cookie settings": a button analytics.js appends to the footer row, styled as a link */
.smll-cookie-settings {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-shadow: inherit;
  cursor: pointer;
}

.smll-cookie-settings[hidden] { display: none; }

/* =================================================================== 7. Buttons */

/* The lime-outlined call to action: "talk with us about your data" and its siblings. */
.button {
  display: inline-flex;
  align-items: center;
  height: 42px;
  padding: 0 20px;
  border: 1.5px solid var(--lime);
  border-radius: 6px;
  background: none;
  color: var(--lime);
  font-family: var(--mono);
  font-size: var(--ui);
  text-decoration: none;
  cursor: pointer;
}

/* ==================================================================== 8. Shared */

/* the line under a page's heading (home, not-found) */
.lede {
  margin: 30px 0 0;
  font-size: var(--body);
  line-height: var(--body-lh);
}

/* Read by screen readers, not shown: "(opens in a new tab)" on the contact form button. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ================================================================ 9. Page: home */

.home {
  display: grid;
  grid-template-columns: 430px 1fr;
  column-gap: 50px;
  align-items: start;
}

.home .button { margin-top: 64px; }

/* The example chart: a hand-written inline SVG on Board raised. It scales whole with its
   panel (viewBox, width 100%), callout included. Its marks carry literal colours; its
   text takes them from here so each label blooms in its own colour. */
.chart { margin: 6px 0 0; }

.chart-panel { background: var(--raised); }

.chart svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart text {
  fill: currentColor;
  font-family: var(--mono);
  font-size: 12px;
}

.chart .chart-heading { color: var(--raised-chalk-1); font-size: 16px; }
.chart .chart-callout { color: var(--raised-lime); text-anchor: middle; }
.chart .chart-reference { color: var(--raised-chalk-2); }
.chart .chart-axis { color: var(--raised-chalk-2); text-anchor: end; }

/* the caption is on the Board: secondary chalk, never smaller than 12 px */
.chart figcaption {
  margin-top: 10px;
  color: var(--chalk-2);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 16px;
}

.chart figcaption a {
  color: inherit;
  text-decoration-color: var(--chalk-3);
}

/* ========================================================== 10. Page: not-found */

/* The heading and one explanatory line (a .lede, section 8); no button. Nothing else. */

/* ============================================================ 11. Page: privacy */

/* The one page in ordinary capitalisation and a formal register. Prose is held to a
   readable measure inside the column. */

.privacy .updated {
  margin: 10px 0 0;
  font-family: var(--mono);
  font-size: var(--ui);
  color: var(--chalk-2);
}

.privacy .summary {
  max-width: 38em;
  margin-top: 30px;
}

.privacy .summary p,
.privacy .summary li {
  font-size: var(--body);
  line-height: var(--body-lh);
}

.privacy h2 {
  margin: 48px 0 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
}

.privacy p,
.privacy li {
  max-width: 38em;
  font-size: 17px;
  line-height: 1.5;
}

.privacy p { margin: 10px 0 0; }

.privacy ul {
  margin: 10px 0 0;
  padding-left: 1.1em;
}

.privacy li { margin-top: 4px; }

.privacy li::marker { color: var(--chalk-3); }

.privacy a {
  text-decoration-color: var(--chalk-3);
  text-underline-offset: 2px;
}

.privacy code {
  font-family: var(--mono);
  font-size: .95em;
}

.privacy .inline-settings { margin-top: 14px; }

/* The cookies-and-storage table on Board raised, with Board raised chalk. */
.cookie-table {
  max-width: 38em;
  margin-top: 16px;
  background: var(--raised);
  color: var(--raised-chalk-1);
}

.cookie-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.4;
}

.cookie-table th,
.cookie-table td {
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
}

.cookie-table th {
  font-family: var(--mono);
  font-size: var(--ui);
  font-weight: 400;
  color: var(--raised-chalk-2);
}

.cookie-table td { border-top: 1px solid var(--raised-chalk-3); }

/* "set by" / "kept for": shown only when the rows stack on phones */
.cookie-table .cell-label {
  display: none;
  color: var(--raised-chalk-2);
}

/* ============================================================ 12. Page: contact */

.contact .button { margin-top: 48px; }

/* ============================================================== 13. Page: about */

/* The thesis, our analytics against traditional analytics, and the flow line. */
.about {
  --about-head: 20px;         /* column headings and row heads */
  --about-row: 16px;          /* row text */
  --flow: 32px;
}

.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 50px;
  margin-top: 50px;
}

.compare h2 {
  margin: 0;
  padding: 0 0 10px 8px;
  border-bottom: 1.5px solid currentColor;
  font-size: var(--about-head);
  line-height: 1.2;
  font-weight: 600;
}

.compare dl {
  margin: 12px 0 0;
  padding-left: 8px;
}

.compare dt {
  margin-top: 18px;
  font-size: var(--about-head);
  line-height: 1.2;
  font-weight: 600;
}

.compare dd {
  margin: 2px 0 0;
  font-size: var(--about-row);
  line-height: 1.2;
}

/* our analytics, and our steps of the flow line, in the Accent */
.compare .ours,
.flow .accent { color: var(--lime); }

.flow {
  margin: 60px 0 0;
  font-size: var(--flow);
  line-height: 1.25;
}

.flow .step { white-space: nowrap; }

.about .button { margin-top: 64px; }

/* =========================================================== 14. Consent banner */

/* analytics.js puts the banner first in <body>, so it is first in the Tab order, and sets
   --consent-height on <html> while it is open: the page reserves that much at the bottom
   and scrolls focused elements clear of it, focus outline included (2 px outline + 2 px
   offset, section 3). Wide: a full-width strip on Board raised, words left and the two
   equal choices right, inside the content column. */
html { scroll-padding-bottom: calc(var(--consent-height, 0px) + 4px); }

body { padding-bottom: var(--consent-height, 0px); }

.smll-consent-shell {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  border-top: 1px solid var(--raised-chalk-3);
  background: var(--raised);
  color: var(--raised-chalk-1);
  box-shadow: 0 -6px 24px var(--shadow);
}

.smll-consent {
  display: flex;
  align-items: center;
  gap: 32px;
  width: var(--column-width);
  margin: 0 auto;
  padding: 16px var(--inset);
}

.smll-consent-words { flex: 1; }

.smll-consent h2 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}

.smll-consent p {
  margin: 0;
  color: var(--raised-chalk-2);
  font-size: 15px;
  line-height: 1.4;
}

.smll-consent p a {
  color: var(--raised-chalk-1);
  text-underline-offset: 2px;
  white-space: nowrap;
}

.smll-consent-actions {
  display: grid;
  flex: none;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* the two choices: equal chalk outlines, never lime, so neither is the nudge. The outline
   is secondary chalk, brightening to primary on hover (section 3). */
.smll-consent-choice {
  min-height: 42px;
  padding: 4px 18px;
  border: 1.5px solid var(--raised-chalk-2);
  border-radius: 6px;
  background: none;
  color: var(--raised-chalk-1);
  font-family: var(--mono);
  font-size: var(--ui);
  line-height: 1.2;
  text-shadow: inherit;
  cursor: pointer;
}

/* =================================================================== 15. Narrow */

@media (max-width: 920px) {
  :root {
    --h1: 26px;   --h1-lh: 32px;
    --body: 18px; --body-lh: 24px;
    --margin: 16px;
    --inset: 0px;
    --cell-h: 44px;            /* site header cells: a phone tap target */
  }

  main {
    padding-top: 36px;
    padding-bottom: 64px;
  }

  /* Phone site header: the wide row, scrolling sideways inside itself so the page body
     never does. The header bleeds to the window edges and the page margin moves inside
     the row, so its ends rest against the margin and a focused tab scrolls clear of the
     fade. 8 + (4 + 44 + 4) + 6 + 1 = 67 px tall; the 4 px above and below the cells keep
     the focus outline from being clipped by the scroller. Not sticky. */
  .site-header {
    margin: 0 calc(-1 * var(--margin));
    padding-top: 8px;
  }

  .site-header hr { margin: 6px var(--margin) 0; }

  .site-nav {
    height: calc(var(--cell-h) + 8px);
    padding: 4px var(--margin);
    overflow-x: auto;
    scroll-padding: 0 var(--margin);
    scrollbar-width: none;
  }

  .site-nav::-webkit-scrollbar { display: none; }

  /* the row keeps its wide sizes: nothing shrinks or wraps to fit the window */
  .site-nav ul { flex: none; }
  .contact-tab { white-space: nowrap; }

  /* The scroll hint: a fade one page margin wide on whichever edge has more row past it.
     /site-header.js sets data-fade as the row scrolls. The mask is alpha, not colour. */
  .site-nav[data-fade="left"] {
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--margin));
    mask-image: linear-gradient(to right, transparent 0, #000 var(--margin));
  }

  .site-nav[data-fade="right"] {
    -webkit-mask-image: linear-gradient(to left, transparent 0, #000 var(--margin));
    mask-image: linear-gradient(to left, transparent 0, #000 var(--margin));
  }

  .site-footer .row { gap: 12px 28px; }

  .home { grid-template-columns: minmax(0, 1fr); }
  .home .button { margin-top: 32px; }
  .chart { margin-top: 40px; }

  /* privacy: the cookies table stacks, one block per row, with "set by" / "kept for" */
  .cookie-table thead { display: none; }
  .cookie-table table,
  .cookie-table tbody,
  .cookie-table tr,
  .cookie-table td { display: block; }
  .cookie-table tr { padding: 12px 14px; }
  .cookie-table tr + tr { border-top: 1px solid var(--raised-chalk-3); }
  .cookie-table td {
    padding: 2px 0;
    border: 0;
  }
  .cookie-table .cell-label { display: inline; }

  .contact .button { margin-top: 40px; }

  .about {
    --about-row: 15.5px;
    --flow: min(26px, 6.7vw);  /* 26 px from 390 px; shrinks below so the longest step fits at 320 */
  }
  .compare {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 40px;
    margin-top: 40px;
  }
  .compare h2,
  .compare dl { padding-left: 0; }
  .flow { margin-top: 48px; }
  .flow .step { display: block; }  /* one step per line */
  .about .button { margin-top: 40px; }

  /* the consent banner becomes a bottom sheet: words, then the choices side by side */
  .smll-consent {
    display: block;
    padding: 18px 0 calc(18px + env(safe-area-inset-bottom));
  }
  .smll-consent h2 { margin-bottom: 8px; }
  .smll-consent-actions { margin-top: 16px; }
  .smll-consent-choice { min-width: 0; padding: 4px 12px; }
}
