/* The privacy statement (privacy.html and its translations in nl/, fr/, es/, ca/ and pt/): a page
   of text in the app's colours.
   Its own file, as the Content-Security-Policy allows no inline styles. */

:root {
  color-scheme: dark;
  /* The app's colours (src/style.css): its popovers' sheet, groups, text and accent. */
  --background: rgb(27 30 41);
  --surface: rgb(255 255 255 / 5%);
  --hairline: rgb(255 255 255 / 10%);
  --pressed: rgb(124 156 250 / 14%);
  --edge: rgb(255 255 255 / 16%);
  --shadow: rgb(0 0 0 / 30%);
  --text: rgb(238 242 255);
  /* Running text, a little dimmer than the headings. */
  --body: rgb(238 242 255 / 82%);
  --secondary: rgb(238 242 255 / 62%);
  --accent: rgb(124 156 250);
  /* The column: one of text on a phone, wide enough for two cards side by side on a desktop. */
  --page: 40rem;
}

@media (min-width: 960px) {
  :root {
    --page: 62rem;
  }
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --background: rgb(252 253 255);
    --surface: rgb(76 90 132 / 8%);
    --hairline: rgb(218 229 244);
    --pressed: rgb(53 96 223 / 8%);
    --edge: rgb(218 229 244);
    --shadow: rgb(0 0 0 / 11%);
    --text: rgb(20 35 80);
    --body: rgb(20 35 80 / 88%);
    --secondary: rgb(76 90 132);
    --accent: rgb(53 96 223);
  }
}

html {
  background: var(--background);
}

body {
  max-width: var(--page);
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(40px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  color: var(--body);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--accent);
  text-underline-offset: 2px;
}

/* What the app sets in SF Pro Rounded (src/type.css): Poncho's name, the headings and the
   language button. */
.app,
.language,
h1,
h2,
h3 {
  font-family: ui-rounded, 'SF Pro Rounded', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.app {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.app img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

/* Lucide's icons (https://lucide.dev), as in the app: drawn in the colour of the words around them. */
.action svg,
.language svg,
.languages svg,
.flow svg {
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The statement in the other languages: a globe with this one's name, which unfolds a list of
   all six under it. A popover, so it closes on a tap outside or Escape with no script (the CSP
   allows none inline). */
.language {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  anchor-name: --language;
}

.language svg {
  width: 17px;
  height: 17px;
}

.language .chevron {
  width: 15px;
  height: 15px;
  margin-right: -3px;
  color: var(--secondary);
}

/* In the top layer, a popover set absolute is placed on the page, so it scrolls with the button.
   Under it and lined up with its right edge: by the anchor where the browser can, else by where
   the button is, at the top of the column. */
.languages {
  position: absolute;
  inset: auto;
  top: calc(max(16px, env(safe-area-inset-top)) + 42px);
  right: max(16px, env(safe-area-inset-right), (100% - var(--page)) / 2);
  min-width: 200px;
  margin: 0;
  padding: 6px;
  border: 0.5px solid var(--edge);
  border-radius: 20px;
  background: var(--background);
  box-shadow: 0 12px 40px var(--shadow);
  font-size: 17px;
  transition:
    opacity 0.15s ease-in,
    transform 0.2s cubic-bezier(0.4, 0, 1, 1),
    overlay 0.2s allow-discrete,
    display 0.2s allow-discrete;
  transform-origin: top right;
}

@supports (anchor-name: --language) {
  .languages {
    position-anchor: --language;
    top: calc(anchor(bottom) + 6px);
    right: anchor(right);
  }
}

/* Unfolding from the button as the app's popovers do, and folding back twice as fast. */
.languages:popover-open {
  transition:
    opacity 0.2s ease-out,
    transform 0.4s cubic-bezier(0.2, 0, 0, 1),
    overlay 0.4s allow-discrete,
    display 0.4s allow-discrete;
}

.languages:not(:popover-open) {
  opacity: 0;
  transform: translateY(-6px) scale(0.94);
}

@starting-style {
  .languages:popover-open {
    opacity: 0;
    transform: translateY(-6px) scale(0.94);
  }
}

.languages a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 14px;
  color: var(--text);
  text-decoration: none;
}

.languages a:hover,
.languages a:focus-visible {
  background: var(--pressed);
  outline: none;
}

.languages a[aria-current] {
  color: var(--accent);
  font-weight: 600;
}

.languages a svg {
  width: 18px;
  height: 18px;
}

h1,
h2,
h3 {
  color: var(--text);
}

h1 {
  margin: 28px 0 0;
  font-size: 34px;
  line-height: 1.15;
}

/* When the statement last changed: there for whoever needs it, quiet for everyone else. */
.updated {
  margin: 6px 0 20px;
  color: var(--secondary);
  font-size: 13px;
  opacity: 0.8;
}

/* What the whole statement comes down to, larger than the rest. */
.lead {
  color: var(--text);
  font-size: 21px;
  line-height: 1.4;
}

h2 {
  margin: 32px 0 8px;
  font-size: 22px;
  line-height: 1.25;
}

p {
  max-width: 40rem;
  margin: 0 0 12px;
}

/* Each section in one line, before the longer version under it. */
.gist {
  color: var(--text);
  font-weight: 500;
}

/* On a desktop, the ways data leaves the device two by two. */
.flows {
  display: grid;
  /* Each card its own height, so opening one doesn't stretch its neighbour. */
  align-items: start;
  gap: 12px;
  margin: 12px 0;
}

@media (min-width: 960px) {
  .flows {
    grid-template-columns: 1fr 1fr;
  }
}

/* Each way data leaves the device: what, how long it's kept, and why. Folded to its title and
   its one line; a tap anywhere on them unfolds the rest. */
.flow {
  margin: 12px 0;
  border-radius: 16px;
  background: var(--surface);
}

.flow summary {
  padding: 14px 16px;
  border-radius: 16px;
  list-style: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.flow summary::-webkit-details-marker {
  display: none;
}

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

.flow summary .gist {
  margin: 0;
}

.flow[open] summary {
  padding-bottom: 10px;
}

.flow > p,
.flow > dl {
  margin-right: 16px;
  margin-left: 16px;
}

/* Unfolding as the app's popovers do, where the browser can animate to the height of the content. */
@supports selector(::details-content) {
  .flow {
    interpolate-size: allow-keywords;
  }

  .flow::details-content {
    block-size: 0;
    overflow: clip;
    transition:
      block-size 0.3s cubic-bezier(0.2, 0, 0, 1),
      content-visibility 0.3s allow-discrete;
  }

  .flow[open]::details-content {
    block-size: auto;
  }
}

.flows .flow {
  margin: 0;
}

/* The longer version in smaller type than its one line. */
.flow p:not(.gist) {
  font-size: 15px;
}

/* The card's icon in a tinted square on its own row, the chevron across from it, the title under
   them. */
.flow h3 {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px 8px;
  margin: 0 0 6px;
  font-size: 17px;
}

.flow h3 > svg:first-child {
  box-sizing: border-box;
  width: 36px;
  height: 36px;
  padding: 8px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
}

.flow .chevron {
  grid-row: 1;
  grid-column: 2;
  width: 18px;
  height: 18px;
  color: var(--secondary);
  transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.flow[open] .chevron {
  transform: rotate(180deg);
}

.flow dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin-top: 0;
  margin-bottom: 14px;
  padding-top: 10px;
  border-top: 0.5px solid var(--hairline);
  font-size: 15px;
}

.flow dt {
  color: var(--secondary);
}

.flow dd {
  margin: 0;
}

/* The sources two to a row, on a desktop. */
@media (min-width: 960px) {
  .sources dl {
    grid-template-columns: auto 1fr auto 1fr;
    gap: 6px 12px;
  }
}

@media (max-width: 400px) {
  .flow dl {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .flow dd + dt {
    margin-top: 6px;
  }
}

/* At the end, as in the app's About: feedback and support as tinted buttons, then who makes
   Poncho in small print. */
.end {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 0.5px solid var(--hairline);
  color: var(--secondary);
  font-size: 15px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.action {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  font-family: ui-rounded, 'SF Pro Rounded', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.action svg {
  width: 17px;
  height: 17px;
}
