/* Moonhost: legal and support pages. One stylesheet, system fonts, nothing loaded from elsewhere.
   The colours are the app's night palette (App/Sources/DesignSystem/Theme.swift). The brand is
   dark, so the pages are dark in every setting. */

:root {
  color-scheme: dark;
  --night: #070b16;     /* page */
  --panel: #111831;     /* raised panels */
  --line: #2a3355;      /* hairlines */
  --moon: #f2e8cf;      /* text, "moon cream" */
  --moon-dim: #999489;  /* secondary text: moon cream at 62% on the page colour */
  --silver: #9fb7da;    /* links and accents */
  --ember: #e4572e;     /* warnings */
  --measure: 42rem;
  --serif: ui-serif, "New York", Georgia, "Times New Roman", serif;
  --sans: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

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

body {
  margin: 0;
  background-color: var(--night);
  background-image: radial-gradient(ellipse 80% 22rem at 50% -4rem, var(--panel), var(--night));
  background-repeat: no-repeat;
  color: var(--moon);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

a {
  color: var(--silver);
  text-underline-offset: 0.16em;
  text-decoration-thickness: 1px;
}

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

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

.skip {
  position: absolute;
  left: -999px;
  top: 0;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  padding: 0.5rem 0.75rem;
  background: var(--panel);
  border: 1px solid var(--silver);
  border-radius: 8px;
}

header.site,
nav.langs,
main,
footer.site {
  max-width: var(--measure);
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

/* Header */

header.site {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding-top: 1.25rem;
  padding-bottom: 0.75rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--serif);
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--moon);
  text-decoration: none;
}

.brand img {
  display: block;
  width: 28px;
  height: 28px;
}

nav.site ul,
nav.langs ul {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
}

nav.site ul {
  gap: 0.25rem 1.125rem;
  font-size: 0.9375rem;
}

nav.site a,
nav.langs a {
  display: inline-block;
  padding: 0.375rem 0;
}

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

/* Language switcher: on every page, under the header. */

nav.langs {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

nav.langs ul {
  gap: 0 1rem;
  font-size: 0.875rem;
}

nav.langs a {
  color: var(--moon-dim);
  text-decoration: none;
}

nav.langs a:hover {
  color: var(--silver);
  text-decoration: underline;
}

nav.langs a[aria-current="true"] {
  color: var(--moon);
  font-weight: 600;
}

/* Text */

main {
  padding-top: 1.75rem;
  padding-bottom: 3rem;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

h1 {
  font-size: 2.125rem;
  margin: 0 0 0.375rem;
}

h2 {
  font-size: 1.375rem;
  margin: 2.5rem 0 0.5rem;
  scroll-margin-top: 1rem;
}

h3 {
  font-size: 1.0625rem;
  margin: 1.5rem 0 0.25rem;
  scroll-margin-top: 1rem;
}

p,
ul,
ol,
dl {
  margin: 0 0 1rem;
}

ul,
ol {
  padding-left: 1.25rem;
}

li + li {
  margin-top: 0.3rem;
}

li > ul {
  margin: 0.3rem 0 0;
}

.meta {
  color: var(--moon-dim);
  font-size: 0.9375rem;
}

/* The name of a button, a screen or a setting, as the app shows it. */
.ui {
  font-weight: 600;
  white-space: nowrap;
}

/* Blocks */

.card {
  margin: 1.5rem 0;
  padding: 1.125rem 1.25rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.card > :first-child {
  margin-top: 0;
}

.card > :last-child {
  margin-bottom: 0;
}

.card h2 {
  font-size: 1.1875rem;
}

.notice {
  margin: 1rem 0 1.5rem;
  padding: 0.75rem 1rem;
  background: var(--panel);
  border-left: 3px solid var(--silver);
  border-radius: 4px 12px 12px 4px;
  font-size: 0.9375rem;
}

.notice.warn {
  border-left-color: var(--ember);
}

.notice > :last-child {
  margin-bottom: 0;
}

.toc {
  padding-left: 1.5rem;
  font-size: 0.9375rem;
  columns: 2 15rem;
  column-gap: 2rem;
}

.toc li {
  break-inside: avoid;
}

/* Tables */

.table-wrap {
  margin: 0 0 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  background: var(--panel);
}

th,
td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  font-weight: 600;
}

/* Footer */

footer.site {
  padding-top: 1rem;
  padding-bottom: 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--moon-dim);
  font-size: 0.875rem;
}

footer.site p {
  margin: 0 0 0.375rem;
}

/* The home page: one screen. */

body.home {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
}

body.home main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
  text-align: center;
}

body.home nav.langs {
  width: 100%;
  padding-top: 1rem;
  border-bottom: 0;
}

body.home nav.langs ul {
  justify-content: center;
}

body.home footer.site {
  width: 100%;
  text-align: center;
}

.moon {
  display: block;
  width: 96px;
  height: 96px;
  margin: 0 auto 0.75rem;
}

body.home h1 {
  font-size: 2.75rem;
  margin-bottom: 0.5rem;
}

.lede {
  max-width: 32rem;
  margin: 0 auto 0.75rem;
  font-size: 1.125rem;
}

.promise {
  margin: 0 auto 1.25rem;
  font-family: var(--serif);
  font-size: 1.125rem;
  font-style: italic;
  color: var(--moon-dim);
}

.facts {
  max-width: 30rem;
  margin: 0 auto 1.75rem;
  padding: 0;
  list-style: none;
  color: var(--moon-dim);
  font-size: 0.9375rem;
}

.facts li + li {
  margin-top: 0.25rem;
}

.links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.625rem;
  max-width: 34rem;
  width: 100%;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.links li + li {
  margin-top: 0;
}

.links a {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 3rem;
  padding: 0.625rem 0.75rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--moon);
  font-weight: 600;
  text-decoration: none;
}

.links a:hover {
  border-color: var(--silver);
}

/* Phones */

@media (max-width: 34rem) {
  body {
    font-size: 1rem;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  body.home h1 {
    font-size: 2.25rem;
  }

  .moon {
    width: 80px;
    height: 80px;
  }

  .links {
    grid-template-columns: 1fr;
  }

  .ui {
    white-space: normal;
  }

  /* Each table row becomes a small card with labelled cells. */
  table.stack,
  table.stack tbody,
  table.stack tr,
  table.stack td {
    display: block;
    width: 100%;
  }

  table.stack {
    background: none;
  }

  table.stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  table.stack tr {
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.875rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
  }

  table.stack td {
    padding: 0.25rem 0;
    border: 0;
  }

  table.stack td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--moon-dim);
  }

  table.stack td:first-child {
    font-weight: 600;
  }

  table.stack td:first-child::before {
    display: none;
  }
}

@media print {
  nav,
  .skip {
    display: none;
  }

  html,
  body {
    background: #fff;
    background-image: none;
    color: #000;
  }

  a {
    color: #000;
  }
}
