/*
  Charge Control's legal pages, in Charge Control's own look (see /charge-control/index.html): ember
  gold and near-black on a stone ground, Archivo on its width axis. The title band is the app's gauge,
  charged to 80% with the last 20% left as hatched headroom. Section heads carry the same small gauge.
*/
:root {
  --ember: #f5c400;
  --ink: #111318;
  --stone: #e7e7e1;
  --chalk: #f6f6f2;
  --graphite: #4a4e56;
  --rule: rgba(17, 19, 24, .16);
  --hatch: repeating-linear-gradient(135deg, rgba(17, 19, 24, .2) 0 1px, transparent 1px 9px);
  --col: 36rem;
  --gut: 32px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--stone); color: var(--ink);
  font-family: "Archivo", "Helvetica Neue", Arial, sans-serif; font-stretch: 100%;
  font-size: 18px; line-height: 1.7; -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
::selection { background: var(--ember); color: var(--ink); }
a { color: inherit; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { background: rgba(245, 196, 0, .45); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
.wrap { width: min(var(--col), 100% - 2 * var(--gut)); margin-inline: auto; }

/* ---------- top bar, as on the app's page ---------- */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0;
  width: min(1200px - 64px, 100% - 2 * var(--gut)); margin-inline: auto;
}
.bar .app { display: flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 700; font-size: 1.02rem; }
.bar .app:hover { background: none; }
.bar .app img { width: 36px; height: 36px; border-radius: 10px; }
.bar nav { display: flex; align-items: center; gap: 22px; font-size: .92rem; }
.bar nav a { text-decoration: none; }
.bar .play-mini { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; padding: 7px 14px 7px 11px; border: 1.5px solid var(--ink); border-radius: 999px; }
.bar .play-mini svg { width: 15px; height: 15px; }
.bar .play-mini:hover { background: var(--ink); color: var(--stone); }
.bar .by { color: var(--graphite); }
.bar .by:hover { background: none; color: var(--ink); text-decoration: underline; }

/* ---------- title band: the gauge, charged to 80% ---------- */
.band { display: grid; grid-template-columns: minmax(0, 1fr); }
.band > .bar { grid-row: 1; }
.band > .gauge, .band > .wrap { grid-row: 2; grid-column: 1; }
.gauge { position: relative; overflow: hidden; border-top: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); }
.gauge > * { position: absolute; top: 0; bottom: 0; }
.gauge .fill { left: 0; width: 80%; background: var(--ember); transform-origin: left center; animation: charge 1.5s cubic-bezier(.2, .75, .25, 1) .15s both; }
.gauge .headroom { left: 80%; right: 0; background: var(--hatch); }
.gauge .stop { left: 80%; width: 3px; margin-left: -1.5px; background: var(--ink); }
.gauge .stop::after {
  content: "80%"; position: absolute; left: 14px; top: 22px;
  font-stretch: 125%; font-weight: 800; font-size: clamp(1.2rem, 2.2vw, 2rem); letter-spacing: -.02em; line-height: 1;
}
.gauge .ruler {
  top: auto; left: 0; right: 0; height: 36px;
  background:
    linear-gradient(var(--ink), var(--ink)) top left / 100% 1.5px no-repeat,
    linear-gradient(to right, var(--ink) 1.5px, transparent 1.5px) top left / 10% 14px repeat-x,
    linear-gradient(to right, rgba(17, 19, 24, .5) 1px, transparent 1px) top left / 5% 8px repeat-x;
}
@keyframes charge { from { transform: scaleX(.14); } to { transform: scaleX(1); } }

/* The title sits inside the ember fill, its left edge on the reading column's. */
.band > .wrap {
  --x: max(var(--gut), calc(50% - var(--col) / 2));
  position: relative; z-index: 1; margin: 0 0 0 var(--x);
  width: min(var(--col), calc(80% - 28px - var(--x)));
}
.hero { padding: 48px 0 84px; }
.eyebrow { margin: 0 0 16px; font-size: .95rem; font-stretch: 87%; font-weight: 700; letter-spacing: .01em; }
h1 {
  margin: 0 0 26px; font-stretch: 125%; font-weight: 800; letter-spacing: -.035em; line-height: 1;
  font-size: clamp(2.1rem, 4.4vw, 3.6rem); text-wrap: balance;
}
.meta { display: grid; gap: 2px; font-size: .97rem; line-height: 1.5; }
.meta b { font-weight: 700; }
.meta code { font-size: .9em; background: rgba(17, 19, 24, .1); }

/* ---------- contents ---------- */
.toc { margin: 56px 0 8px; padding: 26px 30px 22px; background: var(--chalk); border: 1.5px solid var(--ink); border-radius: 22px; }
.toc h2 { margin: 0 0 12px; font-size: .9rem; font-stretch: 87%; font-weight: 700; letter-spacing: .02em; color: var(--graphite); }
.toc ol { margin: 0; padding-left: 1.7em; columns: 2; column-gap: 32px; }
.toc li { margin: 0 0 7px; break-inside: avoid; font-size: .97rem; line-height: 1.45; }
.toc li::marker { font-stretch: 87%; font-weight: 700; color: var(--ink); }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* ---------- the document ---------- */
main { padding: 16px 0 96px; }
section { padding: 40px 0 10px; border-top: 1px solid var(--rule); scroll-margin-top: 12px; }
section:first-of-type { border-top: 0; }
h2.sec {
  margin: 0 0 18px; font-stretch: 125%; font-weight: 800; letter-spacing: -.03em; line-height: 1.1;
  font-size: clamp(1.45rem, 2.4vw, 1.85rem); text-wrap: balance;
}
/* A small gauge, 80% full, over each section head. */
h2.sec::before {
  content: ""; display: block; width: 30px; height: 10px; margin-bottom: 14px; border-radius: 2px;
  background: linear-gradient(to right, var(--ember) 80%, transparent 80%), var(--hatch);
  box-shadow: inset 0 0 0 1.5px var(--ink);
}
h3 { margin: 30px 0 8px; font-stretch: 112%; font-size: 1.14rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; }
p { margin: 0 0 18px; }
p, li, td { text-wrap: pretty; }
ul { margin: 0 0 18px; padding: 0; list-style: none; }
ul > li { position: relative; margin: 0 0 10px; padding-left: 22px; }
ul > li::before {
  content: ""; position: absolute; left: 1px; top: .62em; width: 8px; height: 8px; border-radius: 2px;
  background: var(--ember); box-shadow: inset 0 0 0 1px rgba(17, 19, 24, .45);
}
strong, b { font-weight: 700; }
code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .84em;
  background: rgba(17, 19, 24, .07); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere;
}

/* Tables: a chalk sheet that scrolls inside its own box on a phone. */
.table-scroll {
  --w: min(820px, 100vw - 2 * var(--gut));
  width: var(--w); margin: 6px 0 24px calc((100% - var(--w)) / 2);
  overflow-x: auto; background: var(--chalk);
  border: 1.5px solid var(--ink); border-radius: 18px; -webkit-overflow-scrolling: touch;
}
table { width: 100%; border-collapse: collapse; font-size: .94rem; line-height: 1.5; min-width: 560px; }
table:has(th:nth-child(4)) { min-width: 720px; }
th, td { text-align: left; vertical-align: top; padding: 13px 16px; border-bottom: 1px solid var(--rule); }
th { font-stretch: 87%; font-size: .86rem; font-weight: 700; letter-spacing: .01em; color: var(--graphite); border-bottom: 1.5px solid var(--ink); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td:first-child { width: 30%; }

/* Callouts: the app's "headroom" strip, hatched, down the left edge. */
.callout {
  position: relative; margin: 8px 0 24px; padding: 18px 24px 18px 62px;
  background: var(--chalk); border: 1.5px solid var(--ink); border-radius: 18px; overflow: hidden;
}
.callout::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 38px;
  background: var(--hatch); border-right: 1.5px solid var(--ink);
}
.callout p:last-child { margin-bottom: 0; }

/* ---------- footer, as on the app's page ---------- */
footer { border-top: 1.5px solid var(--ink); padding: 40px 0 56px; font-size: .92rem; color: var(--graphite); }
footer .wrap { width: min(1200px - 64px, 100% - 2 * var(--gut)); display: flex; flex-wrap: wrap; gap: 14px 32px; justify-content: space-between; align-items: baseline; }
footer ul { display: flex; flex-wrap: wrap; gap: 10px 22px; list-style: none; margin: 0; padding: 0; }
footer ul > li { margin: 0; padding: 0; }
footer ul > li::before { content: none; }
footer a { color: var(--ink); }

@media (max-width: 760px) {
  .toc ol { columns: 1; }
}
@media (max-width: 600px) {
  :root { --gut: 20px; }
  body { font-size: 17px; }
  .bar nav { gap: 14px; }
  .bar .app span { display: none; }
  .hero { padding: 34px 0 70px; }
  .eyebrow { font-size: .88rem; }
  .meta { font-size: .92rem; }
  .gauge .stop::after { left: 9px; top: 16px; }
  .gauge .ruler { height: 30px; background-size: 100% 1.5px, 20% 12px, 10% 7px; }
  .toc { margin-top: 40px; padding: 22px 20px 18px; border-radius: 18px; }
  .callout { padding: 16px 18px 16px 44px; }
  .callout::before { width: 24px; }
  th, td { padding: 12px 14px; }
  /* Two-column tables stack on a phone, as the app's own page does with its table:
     the permission on its own line, the reason under it. Wider tables keep scrolling in their box. */
  table:not(:has(th:nth-child(3))) { min-width: 0; }
  table:not(:has(th:nth-child(3))) :is(tbody, tr, td) { display: block; width: auto; }
  table:not(:has(th:nth-child(3))) thead tr { display: flex; gap: 6px 14px; flex-wrap: wrap; padding: 12px 16px 11px; border-bottom: 1.5px solid var(--ink); }
  table:not(:has(th:nth-child(3))) th { padding: 0; border: 0; }
  table:not(:has(th:nth-child(3))) tr { padding: 14px 16px 15px; border-bottom: 1px solid var(--rule); }
  table:not(:has(th:nth-child(3))) tbody tr:last-child { border-bottom: 0; }
  table:not(:has(th:nth-child(3))) td { padding: 0; border: 0; }
  table:not(:has(th:nth-child(3))) td:first-child { margin-bottom: 5px; font-weight: 600; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .gauge .fill { animation: none; }
}
