/* Site stylesheet. The design system and its reasoning are in site/Presence.md. */

/* Fonts: Source Sans 3, weights 400 to 700, Latin. License in /fonts/OFL.txt. */
@font-face {
  font-family: "Source Sans 3";
  src: url("/fonts/source-sans-3.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("/fonts/source-sans-3-italic.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}

/* Tokens */
:root {
  color-scheme: light dark;

  /* Palette: each color follows color-scheme through light-dark(). */
  --bg: light-dark(#fbfaf7, #14171b);
  --surface: light-dark(#f2f0eb, #1c2025);
  --text: light-dark(#1d2025, #e4e6e9);
  --muted: light-dark(#565d68, #a2a9b3);
  --accent: light-dark(#1e4d8c, #8fb6ec);
  --rule: light-dark(#d8d5ce, #353a41);

  /* Type scale: steps of the square root of the golden ratio. */
  --step--1: 0.786rem;
  --step-0: 1rem;
  --step-half: 1.128rem;
  --step-1: 1.272rem;
  --step-2: 1.618rem;

  /* Spacing: powers of the golden ratio. */
  --s-2: 0.382rem;
  --s-1: 0.618rem;
  --s0: 1rem;
  --s1: 1.618rem;
  --s2: 2.618rem;
  --s3: 4.236rem;

  /* Widths: the frame carries the layout, the measure carries running text. */
  --frame: 33.25rem;
  --measure: calc(var(--frame) / 1.128);
}

@supports not (color: light-dark(#000, #fff)) {
  :root {
    --bg: #fbfaf7;
    --surface: #f2f0eb;
    --text: #1d2025;
    --muted: #565d68;
    --accent: #1e4d8c;
    --rule: #d8d5ce;
  }
}

/* Theme: set by the footer's radio inputs, or by /js/theme.js from a saved choice. */
:root:has(#theme-light:checked),
:root[data-theme="light"] {
  color-scheme: light;
}
:root:has(#theme-dark:checked),
:root[data-theme="dark"] {
  color-scheme: dark;
}

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

html {
  /* 18px on a phone to 20px from a 1280px viewport. */
  font-size: clamp(1.125rem, 1.068rem + 0.227vw, 1.25rem);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
}

main {
  flex: 1;
}

h1,
h2,
h3,
h4 {
  font-weight: 600;
  line-height: 1.25;
  text-wrap: balance;
  margin: var(--s2) 0 var(--s-1);
}
h1 {
  font-size: clamp(1.435rem, 1.1rem + 1.2vw, var(--step-2));
  margin-top: 0;
}
h2 {
  font-size: var(--step-1);
}
h3 {
  font-size: var(--step-half);
}
h4 {
  font-size: var(--step-0);
}

p,
ul,
ol {
  margin: 0 0 var(--s0);
}
p,
li {
  text-wrap: pretty;
}
ul,
ol {
  padding-left: 0;
}
li + li {
  margin-top: var(--s-2);
}

strong,
b {
  font-weight: 700;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover {
  text-decoration-thickness: 2px;
}

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

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

hr {
  max-width: var(--frame);
  margin: var(--s1) 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

/* Lists with drawn markers: the marker on the text edge, the text just past it. */
.document ul,
ol.steps {
  list-style: none;
}
.document ul > li,
ol.steps > li {
  position: relative;
  padding-left: 1.3em;
}
.document ul > li::before {
  content: "\2022";
  position: absolute;
  left: 0;
}
ol.steps {
  counter-reset: step;
}
ol.steps > li {
  counter-increment: step;
}
ol.steps > li::before {
  content: counter(step) ".";
  position: absolute;
  left: 0;
  font-weight: 700;
}

/* Layout */
.wrap {
  width: min(100% - 2 * var(--s1), var(--frame));
  margin-inline: auto;
}
main.wrap {
  padding-block: var(--s2) var(--s3);
}
main :is(p, ul, ol, dl) {
  max-width: var(--measure);
}
main :is(.samples, .badges, .toc-inline ol) {
  max-width: none;
}

.skip {
  position: absolute;
  left: var(--s0);
  top: -10rem;
  padding: var(--s-2) var(--s-1);
  background: var(--accent);
  color: var(--bg);
}
.skip:focus {
  top: var(--s0);
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--rule);
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-1) var(--s1);
  padding-block: var(--s1) var(--s0);
}
.brand {
  display: flex;
  flex-direction: column;
  color: var(--text);
  text-decoration: none;
}
.brand-name {
  font-size: var(--step-1);
  font-weight: 700;
  line-height: 1.25;
}
.brand-category {
  font-size: var(--step--1);
  color: var(--muted);
}
.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s1);
  list-style: none;
  margin: 0;
}
.site-nav li + li {
  margin-top: 0;
}
.site-nav a {
  color: var(--text);
  text-decoration: none;
  padding-block: var(--s-2);
}
.site-nav a:hover,
.site-nav a[aria-current] {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.35em;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: var(--step--1);
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s0) var(--s1);
  padding-block: var(--s1) var(--s2);
}
.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s1);
  list-style: none;
  margin: 0;
}
.site-footer li + li {
  margin-top: 0;
}

/* Footer icons, in the text color. LinkedIn's image is a mask so it takes it too. */
.icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: 0.4em;
  vertical-align: -0.15em;
  fill: var(--text);
}
.icon-linkedin {
  width: 1.08em;
  background: var(--text);
  mask: url("/img/icons/linkedin.png") center / contain no-repeat;
}

/* Theme control: three radio inputs shown as one segmented control. */
.theme {
  display: flex;
  align-items: center;
  border: 0;
  margin: 0;
  padding: 0;
}
.theme input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.theme label {
  padding: 0.1em 0.7em;
  border: 1px solid var(--rule);
  cursor: pointer;
}
.theme label + input + label {
  border-left: 0;
}
.theme label:first-of-type {
  border-radius: 0.3em 0 0 0.3em;
}
.theme label:last-of-type {
  border-radius: 0 0.3em 0.3em 0;
}
.theme input:checked + label {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}
.theme input:focus-visible + label {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Introductions: a page's opening paragraph, and Home's credentials line. */
.lede,
.credibility {
  max-width: var(--frame);
  font-size: var(--step-half);
  line-height: 1.55;
}
.credibility {
  color: var(--muted);
}

/* Home's headline phrases, kept whole where the frame is at full width. */
@media (min-width: 43em) {
  .keep {
    white-space: nowrap;
  }
}

/* Sample entries on Home and the samples index */
.samples {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--s1);
  border-bottom: 1px solid var(--rule);
}
.samples li {
  margin: 0;
  padding-block: var(--s0);
  border-top: 1px solid var(--rule);
}
.samples a {
  font-weight: 600;
}
.samples p {
  margin: var(--s-2) 0 0;
}

/* Sample pages: findings, their section references, and the onward line. */
.finding a {
  white-space: nowrap;
}
.refs {
  display: block;
  margin-top: var(--s-2);
  font-size: 0.9rem;
}
.actions {
  max-width: var(--frame);
  margin-top: var(--s1);
  padding-top: var(--s0);
  border-top: 1px solid var(--rule);
}

/* Credential badges: five across, or three over two on a phone. */
.badges {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 3.5rem));
  justify-content: center;
  gap: var(--s0);
  margin: 0;
  padding: var(--s0) 0 0;
  list-style: none;
  border-top: 1px solid var(--rule);
}
.badges li {
  grid-column: span 2;
  margin: 0;
}
.badges li:nth-child(4) {
  grid-column: 2 / span 2;
}
@media (min-width: 37em) {
  .badges {
    grid-template-columns: repeat(5, 1fr);
  }
  .badges li,
  .badges li:nth-child(4) {
    grid-column: auto;
  }
}
.badges a {
  display: block;
  padding: var(--s-2);
  border-radius: var(--s-1);
  background: light-dark(#f2f0eb, #fbfaf7);
}
.badges a:hover {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.badges img {
  display: block;
  width: 100%;
  height: auto;
}

/* The policy page: its contents disclosure, and the policy on its own sheet. */
.toc-inline {
  position: sticky;
  top: var(--s-2);
  z-index: 2;
  margin-bottom: var(--s1);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--s-2);
  padding: var(--s-1) var(--s0);
}
.toc-inline summary {
  cursor: pointer;
  font-weight: 600;
}
.toc-inline[open] summary {
  margin-bottom: var(--s-1);
}
.toc-inline ol {
  list-style: none;
  margin: 0;
  max-height: 60vh;
  overflow-y: auto;
  font-size: var(--step--1);
  line-height: 1.4;
}
.toc-inline a {
  color: var(--muted);
  text-decoration: none;
}
.toc-inline a:hover {
  color: var(--accent);
  text-decoration: underline;
}
@supports selector(::details-content) {
  :root {
    interpolate-size: allow-keywords;
  }
  .toc-inline::details-content {
    block-size: 0;
    overflow: clip;
    transition: block-size 0.382s ease, content-visibility 0.382s allow-discrete;
  }
  .toc-inline[open]::details-content {
    block-size: auto;
  }
}
[id] {
  scroll-margin-top: var(--s3);
}

.document {
  margin: var(--s2) calc(-1 * var(--s1)) 0;
  padding: var(--s1);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--s-2);
}
@media (max-width: 43em) {
  .document {
    border-radius: 0;
    border-inline: 0;
  }
}
.document .doc-title {
  margin-top: 0;
}
.document h3 {
  padding-top: var(--s0);
  border-top: 1px solid var(--rule);
}
.document h4 {
  margin-top: var(--s1);
}
.doc-org {
  font-size: var(--step-1);
}
.addresses {
  margin-top: calc(-1 * var(--s-2));
  color: var(--muted);
  font-size: 0.9rem;
}
.document dl {
  margin: 0;
}
.document dt {
  font-weight: 700;
}
.document dd {
  margin: 0 0 var(--s0);
}

/* Tables: a wide one scrolls within the frame. */
.table-scroll {
  overflow-x: auto;
  margin: 0 0 var(--s0);
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
  line-height: 1.5;
}
th,
td {
  text-align: left;
  vertical-align: top;
  padding: var(--s-2) var(--s-1);
  border-bottom: 1px solid var(--rule);
}
th {
  font-weight: 600;
}
thead th {
  border-bottom: 2px solid var(--muted);
}
table.control-block {
  width: auto;
  margin: var(--s0) 0;
}
.control-block th {
  padding-left: 0;
  white-space: nowrap;
}
@media (min-width: 37em) {
  .table-scroll th,
  .table-scroll td:first-child,
  .table-scroll td.refs-cell {
    white-space: nowrap;
  }
}

/* Utilities */
.nowrap {
  white-space: nowrap;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
