/*
 * Wane website — the one stylesheet both pages share.
 *
 * Constraints (GitHub issue #162; checked by scripts/check_website.py):
 * - Nothing from another origin: system fonts only, no @import, no remote url().
 * - No inline styles anywhere: the Content-Security-Policy in _headers allows
 *   stylesheets from this origin only, so a style attribute is silently dropped.
 * - Every --color-text-* and --color-link token reaches 4.5:1 against
 *   --color-background, in both appearances. --color-accent is not text: it
 *   draws the current-page marker and focus ring, and needs 3:1.
 */

:root {
  color-scheme: light dark;

  --color-background: #fbfbfd;
  --color-divider: #e3e5ea;
  --color-text-primary: #111318;
  --color-text-body: #3a3e46;
  --color-text-muted: #5b616b;
  /* #0088FF (the app's AccentColor) at 40% lightness: same hue, dark enough for text. */
  --color-link: #006dcc;
  --color-accent: #0088ff;

  --column-width: 38rem;
  --header-width: 50rem;
  --gutter: 1rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-background: #0f1115;
    --color-divider: #262a31;
    --color-text-primary: #f2f3f5;
    --color-text-body: #c8cbd1;
    --color-text-muted: #9da3ac;
    --color-link: #0088ff;
    --color-accent: #0088ff;
  }
}

/* ---- Base ---------------------------------------------------------------- */

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

html {
  /* 17px at the browser's default text size, and scales with the reader's setting. */
  font-size: 106.25%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* iOS Safari: follow the Dynamic Type text size set in the iPhone's settings. */
@supports (font: -apple-system-body) and (-webkit-touch-callout: none) {
  html {
    font: -apple-system-body;
  }
}

body {
  margin: 0;
  background: var(--color-background);
  color: var(--color-text-body);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--color-link);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

/*
 * An address is one unit: it moves to the next line whole rather than breaking at
 * its hyphen, and only breaks inside when it is wider than the column (very large
 * text on a narrow phone).
 */
a[href^="mailto:"] {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

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

strong {
  color: var(--color-text-primary);
  font-weight: 600;
}

a strong {
  color: inherit;
}

/* ---- Header -------------------------------------------------------------- */

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

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: space-between;
  column-gap: 1.5rem;
  max-width: var(--header-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 0;
  color: var(--color-text-primary);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  text-decoration: none;
}

.brand__mark {
  display: block;
  width: 2rem;
  height: 2rem;
  border-radius: 22.5%;
}

.site-nav ul {
  display: flex;
  gap: 1.75rem;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0.875rem 0;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--color-text-primary);
}

.site-nav a[aria-current="page"] {
  color: var(--color-link);
  font-weight: 600;
}

/* The current-page marker sits on the header's bottom rule. */
.site-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--color-accent);
}

/* ---- Page ---------------------------------------------------------------- */

.page {
  max-width: var(--column-width);
  margin: 0 auto;
  padding: 2.5rem var(--gutter) 4rem;
}

/*
 * Flow spacing uses :where() so it stays at single-class specificity: the
 * .page__updated and .page__lead rules below must be able to override it.
 */
.page :where(p, ul) {
  margin: 0;
}

.page :where(p + p, p + ul, ul + p) {
  margin-top: 0.875rem;
}

.page h1 {
  margin: 0;
  color: var(--color-text-primary);
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.page__updated {
  margin-top: 0.75rem;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

.page__lead {
  margin-top: 1.25rem;
  font-size: 1.1875rem;
  line-height: 1.55;
}

.page section {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-divider);
}

.page h2 {
  margin: 0 0 0.625rem;
  color: var(--color-text-primary);
  font-size: 1.3125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.page ul {
  padding-left: 1.25rem;
}

.page li + li {
  margin-top: 0.5rem;
}

.page li::marker {
  color: var(--color-text-muted);
}

@media (min-width: 48em) {
  :root {
    --gutter: 2rem;
  }

  .page {
    padding-top: 4rem;
    padding-bottom: 6rem;
  }

  .page h1 {
    font-size: 2.75rem;
  }

  .page section {
    margin-top: 2.25rem;
    padding-top: 2.25rem;
  }
}
