/* faraimlive.com: the only stylesheet.
   Colors are the app's own tokens (App/Assets.xcassets and App/Resources/Reader/reader.css in the
   app repository, docs/ARCHITECTURE.md section 10): chart paper, blue-black ink, and the sectional
   chart's magenta and blue. Type is the app's: Literata for reading text, Atkinson Hyperlegible
   Next for the interface. Both are served from fonts/ on this site; nothing is loaded from any
   other server. */

@font-face {
  font-family: "Literata";
  src: url("fonts/Literata.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("fonts/Literata-Italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("fonts/AtkinsonHyperlegibleNext.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("fonts/AtkinsonHyperlegibleNext-Italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}

/* ---------- Tokens ---------- */

:root {
  color-scheme: light dark;

  --paper: #F6F1E7;
  --surface: #FFFDF8;
  --ink: #1D2B36;
  --ink-muted: #5B6670;
  --rule: #D6CCB8;
  --magenta: #A3165F;
  --chart-blue: #1F5FA8;
  --hl-yellow: #F5D76E;
  --hl-green: #9FD6A5;
  --hl-blue: #9CC7F0;
  --hl-pink: #F2A7C7;
  --hl-orange: #F6B87A;
  /* The reader's search-hit wash. */
  --hit: rgba(31, 95, 168, 0.20);

  --reading-font: "Literata", "Iowan Old Style", Georgia, serif;
  --ui-font: "Atkinson Hyperlegible Next", "Avenir Next", sans-serif;
  --code-font: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --gutter: 16px;
  --measure: 40rem;
  --hang: 2.1em;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #10161C;
    --surface: #18212A;
    --ink: #E6E1D6;
    --ink-muted: #9AA3AB;
    --rule: #2A3540;
    --magenta: #E46AA9;
    --chart-blue: #7FB1E8;
    --hl-yellow: #73601D;
    --hl-green: #2F6B3A;
    --hl-blue: #2B5C8A;
    --hl-pink: #8A3560;
    --hl-orange: #8A5524;
    --hit: rgba(127, 177, 232, 0.24);
  }
}

/* Increase Contrast: muted text becomes ink, and the rules take the catalog's inkMuted color.
   The asset catalog has no high-contrast variants, so these reuse its light and dark values. */
@media (prefers-contrast: more) {
  :root { --ink-muted: var(--ink); --rule: #5B6670; }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root { --rule: #9AA3AB; }
}

@media (min-width: 700px) { :root { --gutter: 32px; } }
@media (min-width: 1100px) { :root { --gutter: 48px; } }

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

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

html {
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--reading-font);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  overflow-wrap: break-word;
}

img { max-width: 100%; height: auto; }

p { margin: 0 0 1em; }

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

:focus-visible {
  outline: 3px solid var(--magenta);
  outline-offset: 2px;
  border-radius: 2px;
}
/* The skip link moves focus to <main> (tabindex="-1"), which needs no ring of its own. */
main:focus { outline: none; }

::selection { background: var(--hl-yellow); color: var(--ink); }

code {
  font-family: var(--code-font);
  font-size: 0.86em;
  overflow-wrap: anywhere;
}

.wrap {
  width: 100%;
  max-width: 76rem;
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 10;
  padding: 0.55rem 0.9rem;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--ui-font);
  font-weight: 700;
  text-decoration: none;
  border-radius: 4px;
}
.skip-link:focus { top: 0.6rem; }

/* Small interface text: labels, dates, sources. */
.label {
  font-family: var(--ui-font);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.meta {
  font-family: var(--ui-font);
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--ink-muted);
}
/* A citation as the app sets it: interface face, magenta, figures that line up. */
.cite {
  font-family: var(--ui-font);
  font-weight: 700;
  color: var(--magenta);
  font-variant-numeric: lining-nums tabular-nums;
  white-space: nowrap;
}
.ui { font-family: var(--ui-font); }
.nowrap { white-space: nowrap; }
/* A label line in sentence case, so names such as iPhone keep their capitals. */
.kicker {
  font-family: var(--ui-font);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink-muted);
}
/* Names of the app's own buttons and screens. */
.control {
  font-family: var(--ui-font);
  font-weight: 650;
}

/* ---------- Header and footer ---------- */

.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--ui-font);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.005em;
}
/* The icon images carry the app icon's own rounded shape, rendered by Icon Composer. */
.brand img {
  width: 52px;
  height: 52px;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav a {
  display: inline-block;
  padding: 0.35rem 0;
  color: var(--ink);
  font-family: var(--ui-font);
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { border-bottom-color: var(--rule); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--magenta); }

.site-footer {
  margin-top: 4rem;
  border-top: 2px solid var(--ink);
  font-family: var(--ui-font);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink-muted);
}
.site-footer .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem 3rem;
  padding-top: 1.75rem;
  padding-bottom: 2.5rem;
}
.site-footer p { margin: 0 0 0.35rem; }
.site-footer a { color: var(--ink); }
.site-footer a[href^="mailto:"] { overflow-wrap: anywhere; }
.site-footer ul { margin: 0; padding: 0; list-style: none; }
.site-footer li { margin-bottom: 0.35rem; }
.site-footer .statement { color: var(--ink); font-weight: 600; }
@media (min-width: 800px) {
  .site-footer .wrap { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1.4fr); }
}

/* ---------- Home: title block ---------- */

.hero {
  padding: 3.5rem 0 3rem;
  max-width: 48rem;
}
.hero h1 {
  margin: 0.4rem 0 1.2rem;
  font-family: var(--ui-font);
  font-weight: 800;
  font-size: clamp(2.6rem, 1.6rem + 3.6vw, 4.5rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}
.hero .subtitle {
  font-size: clamp(1.3rem, 1.1rem + 0.7vw, 1.7rem);
  line-height: 1.4;
  margin-bottom: 1rem;
}
.hero > p { max-width: 43rem; }
.hero .launch-details {
  margin: 1.6rem 0 0;
  font-family: var(--ui-font);
  font-size: 0.95rem;
  color: var(--ink-muted);
}

/* ---------- Home: plain text sections ---------- */

.chapter {
  display: grid;
  gap: 0.3rem 3rem;
  padding-top: 2.4rem;
  padding-bottom: 1.4rem;
  border-top: 1px solid var(--rule);
}
.chapter:last-of-type { border-bottom: 0; }
.chapter > h2 {
  margin: 0 0 0.6rem;
  font-family: var(--ui-font);
  font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.75rem);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.01em;
}
.chapter > .body { min-width: 0; max-width: var(--measure); }
@media (min-width: 920px) {
  .chapter {
    grid-template-columns: minmax(12rem, 17rem) minmax(0, var(--measure));
    padding-top: 3rem;
    padding-bottom: 2rem;
  }
  .chapter > h2 { position: sticky; top: 1.25rem; align-self: start; }
}

/* Outline paragraphs, labeled (a), (b), (c) and indented the way the reader indents a rule. */
ol.outline {
  list-style: none;
  margin: 0 0 1.2em;
  padding: 0;
  counter-reset: para;
}
ol.outline > li {
  counter-increment: para;
  position: relative;
  padding-left: var(--hang);
  margin: 0 0 0.75em;
}
ol.outline > li::before {
  content: "(" counter(para, lower-alpha) ")";
  position: absolute;
  left: 0;
  font-variant-numeric: lining-nums tabular-nums;
}
/* Run-in paragraph heading, as the CFR prints one. */
.phead {
  font-family: var(--ui-font);
  font-weight: 700;
}

/* The five highlight colors, by name. */
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.2em;
  padding: 0;
  list-style: none;
  font-family: var(--ui-font);
  font-size: 0.95rem;
  font-weight: 600;
}
.swatches li { padding: 0.15rem 0.6rem; border-radius: 3px; color: var(--ink); }
.swatches .yellow { background: var(--hl-yellow); }
.swatches .green { background: var(--hl-green); }
.swatches .blue { background: var(--hl-blue); }
.swatches .pink { background: var(--hl-pink); }
.swatches .orange { background: var(--hl-orange); }

/* Sources and their editions, laid out like the app's Library. */
.sources { margin: 0 0 1.4em; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.sources > li { padding: 0.95rem 0 1rem; border-bottom: 1px solid var(--rule); }
.sources h3 {
  margin: 0 0 0.3rem;
  font-family: var(--ui-font);
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.3;
}
.sources h3 .cite { margin-right: 0.2em; }
.sources p { margin: 0 0 0.35rem; }
.sources .meta { margin: 0; }
.sources .meta strong { color: var(--ink); font-weight: 700; white-space: nowrap; }

.coverage { margin: 0; }
.coverage > div { margin-bottom: 1.4rem; }
.coverage dt { font-family: var(--ui-font); font-weight: 700; margin-bottom: 0.2rem; }
.coverage dd { margin: 0; }
.coverage dd + dd { margin-top: 0.3rem; }

/* ---------- Document pages: Privacy, Support ---------- */

.doc-head {
  padding-top: 2.5rem;
  padding-bottom: 1.1rem;
  border-bottom: 2px solid var(--ink);
}
.doc-head .label { margin: 0 0 0.3rem; color: var(--magenta); }
.doc-head h1 {
  margin: 0 0 0.5rem;
  font-family: var(--ui-font);
  font-weight: 800;
  font-size: clamp(2rem, 1.6rem + 2vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
}
.doc-head .meta { margin: 0; }
.doc-head .intro { max-width: var(--measure); margin: 0.6rem 0 0.4rem; font-size: 1.12rem; }

.doc-layout {
  display: grid;
  gap: 2rem 3.5rem;
  padding-top: 2rem;
}
@media (min-width: 1000px) {
  .doc-layout { grid-template-columns: 15rem minmax(0, var(--measure)); }
  .toc { position: sticky; top: 1.25rem; align-self: start; max-height: calc(100vh - 2.5rem); overflow-y: auto; }
}

.toc .label { display: block; margin-bottom: 0.5rem; }
.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--ui-font);
  font-size: 0.95rem;
  line-height: 1.35;
}
/* The rule is on each item, so both columns of the two-column list carry it. */
.toc li { margin: 0; }
.toc a {
  display: block;
  padding: 0.3rem 0 0.3rem 0.85rem;
  color: var(--ink);
  text-decoration: none;
}
.toc a:hover { color: var(--chart-blue); text-decoration: underline; }
/* Inset, so the scrolling TOC box on wide screens does not clip the ring. */
.toc a:focus-visible { outline-offset: -3px; }
@media (min-width: 600px) and (max-width: 999px) {
  .toc ol { columns: 2; column-gap: 2rem; }
  .toc li { break-inside: avoid; }
}

.doc { min-width: 0; max-width: var(--measure); }
.doc section { padding-bottom: 0.6rem; }
.doc section + section { border-top: 1px solid var(--rule); padding-top: 1.6rem; }
.doc h2 {
  margin: 0 0 0.9rem;
  font-family: var(--ui-font);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  scroll-margin-top: 1rem;
}
.doc h3 {
  margin: 1.6rem 0 0.45rem;
  font-family: var(--ui-font);
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.3;
  scroll-margin-top: 1rem;
}
.doc h2 + h3 { margin-top: 0.4rem; }
.doc ul, .doc ol:not(.outline) { margin: 0 0 1em; padding-left: 1.3em; }
.doc li { margin-bottom: 0.4em; }
.doc li::marker { color: var(--ink-muted); }

/* Name and value pairs, such as the parts of an update request. */
dl.pairs { margin: 0 0 1.2em; border-top: 1px solid var(--rule); }
dl.pairs > div { padding: 0.6rem 0; border-bottom: 1px solid var(--rule); }
dl.pairs dt { font-family: var(--ui-font); font-weight: 700; }
dl.pairs dd { margin: 0.1rem 0 0; }
@media (min-width: 640px) {
  dl.pairs > div { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 1rem; }
  dl.pairs dd { margin: 0; }
}

/* The developer's postal address and telephone, under Contact. Upright: browsers set <address>
   in italics, and no page uses the italic fonts. */
address { font-style: normal; }
address.postal {
  margin: 0.4rem 0 1em;
  padding: 0.6rem 0 0.1rem;
  border-top: 1px solid var(--rule);
  font-family: var(--ui-font);
  line-height: 1.5;
}
address.postal .label { margin: 0 0 0.3rem; }
address.postal p { margin: 0 0 0.6rem; }
address.postal a[href^="tel:"] { white-space: nowrap; }
address.postal a[href^="mailto:"] { overflow-wrap: anywhere; }

/* A path through the app's screens: Settings, then Content. */
.path { font-family: var(--ui-font); font-weight: 650; }

/* ---------- 404 ---------- */

.not-found { padding-top: 3rem; max-width: var(--measure); }
.not-found .code {
  margin: 0;
  font-family: var(--ui-font);
  font-weight: 800;
  font-size: 1rem;
  color: var(--magenta);
  letter-spacing: 0.04em;
}
.not-found h1 {
  margin: 0.2rem 0 0.8rem;
  font-family: var(--ui-font);
  font-weight: 800;
  font-size: clamp(2rem, 1.6rem + 2vw, 3rem);
  line-height: 1.08;
}
.not-found ul { margin: 1.5rem 0 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.not-found li { border-bottom: 1px solid var(--rule); }
.not-found li a { display: block; padding: 0.75rem 0; font-family: var(--ui-font); font-weight: 700; text-decoration: none; }
.not-found li a span { display: block; font-weight: 400; color: var(--ink-muted); font-size: 0.92rem; }

@media print {
  .site-header nav, .skip-link, .toc { display: none; }
  .chapter > h2 { position: static; }
  body { font-size: 11pt; }
}
