/* Monsi public website. Mobile first; sizes in rem so text reflows at 200 % zoom. */

:root {
  --ground: #ffffff;
  --text: #111111;
  --text-2: #444444;
  --accent: #594ae2;
  --accent-dark: #4334c4;
  --rule: #e6e6e6;
  --band: #f4f3fe;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --measure: 42.5rem; /* 680 px of text */
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;   /* 17 px */
  line-height: 1.75rem;   /* 28 px */
  overflow-wrap: break-word;
}

/* Links: violet, underlined in text, same colour once visited. */
a, a:visited { color: var(--accent); }
a:hover { color: var(--accent-dark); }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Skip link: first in tab order, visible only on focus. */
.skip {
  position: absolute;
  left: 1rem;
  top: -10rem;
  padding: 0.5rem 1rem;
  background: var(--ground);
  z-index: 20; /* above the header, which stays at the top */
}
.skip:focus { top: 0.5rem; }

/* Header: brand left, two links right. Every target at least 44 px tall. */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--ground);
}
.brand, .brand:visited {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  color: var(--text);
  font-weight: 700;
  font-size: 1.125rem;
  text-decoration: none;
}
.site-nav { display: flex; gap: 0.25rem; }
.site-nav a, .site-footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 0.5rem;
}

main {
  display: block;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 2rem; margin: 0.5rem 0 1rem; }
h2 { font-size: 1.5rem; margin: 2.5rem 0 0.75rem; }  /* 24 px */
h3 { font-size: 1.125rem; margin: 1.75rem 0 0.5rem; }
p, ul, ol, table { margin: 0 0 1rem; }
ul, ol { padding-left: 1.25rem; }
li { margin-bottom: 0.375rem; }

.meta { color: var(--text-2); }

/* Home */
.home h1 { font-size: 2.25rem; font-weight: 700; margin-top: 1.5rem; } /* 36 px */
.lead { font-size: 1.1875rem; color: var(--text-2); }
.action, .action:visited {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 1.25rem;
  margin: 0.5rem 0 1.5rem;
  background: var(--accent);
  color: #ffffff;
  border-radius: 0.5rem;
  font-weight: 600;
  text-decoration: none;
}
.action:hover { background: var(--accent-dark); color: #ffffff; }
/* Two actions: stacked full width on a phone, side by side from 48rem. The second is outlined
   so it does not compete with the first. */
.actions { display: flex; flex-direction: column; gap: 0.75rem; margin: 0.5rem 0 1.5rem; }
.actions .action { margin: 0; justify-content: center; }
.action.quiet, .action.quiet:visited {
  background: transparent;
  color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent);
}
.action.quiet:hover { background: var(--band); color: var(--accent-dark); }
.facts { list-style: none; padding: 0; margin: 2rem 0; }
.facts li { padding: 1rem 0; border-top: 1px solid var(--rule); margin: 0; }
.facts li:last-child { border-bottom: 1px solid var(--rule); }
.facts strong { display: block; font-size: 1.25rem; }

/* Policy */
.summary {
  background: var(--band);
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
}
.summary p:last-child { margin-bottom: 0; }
.toc { margin: 1.5rem 0 2rem; }
.toc h2 { font-size: 1.125rem; margin: 0 0 0.5rem; }
.toc ol { padding-left: 1.5rem; }
/* Block, not inline-block: an inline-block's baseline is its last line, which would put the
   number beside the second line of a wrapped item. */
.toc a { display: block; min-height: 2.75rem; padding: 0.5rem 0; }
.toc li { margin: 0; }

/* The jump from the contents list lands below the header and is marked. */
/* Clears the header, which stays at the top: a jump must not land the heading under it. */
main h2[id], main h3[id] { scroll-margin-top: 5.5rem; }
main :target {
  border-left: 4px solid var(--accent);
  padding-left: 0.75rem;
  margin-left: -1rem;
}

.legend {
  border: 1px solid var(--rule);
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
}

/* Wide tables scroll inside their own box, never the page. */
.table-wrap { overflow-x: auto; margin: 0 0 1rem; }
table { border-collapse: collapse; width: 100%; font-size: 1rem; line-height: 1.5rem; }
th, td { text-align: left; vertical-align: top; padding: 0.5rem; border-bottom: 1px solid var(--rule); }
th { font-weight: 600; }

/* On a narrow screen each provider becomes a one-column block: name, then labelled purpose
   and data. The labels come from the page language, so the markup stays a plain table. */
@media (max-width: 39.99rem) {
  .providers thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .providers, .providers tbody, .providers tr, .providers td { display: block; width: auto; }
  .providers tr { padding: 0.75rem 0; border-bottom: 1px solid var(--rule); }
  .providers td { border: 0; padding: 0.125rem 0; }
  .providers td:first-child { font-weight: 600; }
  .providers td:nth-child(2)::before { content: "Para qué: "; color: var(--text-2); }
  .providers td:nth-child(3)::before { content: "Qué recibe: "; color: var(--text-2); }
  html[lang="en"] .providers td:nth-child(2)::before { content: "What for: "; }
  html[lang="en"] .providers td:nth-child(3)::before { content: "What it receives: "; }
}

/* Pending markers: facts still missing, visible until the owner supplies them. */
mark { background: #fff3bf; color: var(--text); }

.site-footer {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.5rem 1rem 2.5rem;
  border-top: 1px solid var(--rule);
  color: var(--text-2);
}
.tap { display: inline-block; min-height: 2.75rem; padding: 0.5rem 0; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0 1rem; }
.site-footer nav a { padding: 0; }

@media (min-width: 48rem) {
  .site-header { padding: 0.5rem 2rem; }
  .home h1 { font-size: 3.5rem; } /* 56 px */
  .actions { flex-direction: row; flex-wrap: wrap; }
  h1 { font-size: 2.5rem; }
}

/* At 1024 px and up the contents list sits beside the text. */
@media (min-width: 64rem) {
  .policy {
    max-width: calc(var(--measure) + 17rem);
    display: grid;
    grid-template-columns: 15rem minmax(0, var(--measure));
    column-gap: 2rem;
    align-items: start;
  }
  .policy > .policy-head { grid-column: 2; grid-row: 1; }
  .policy > .policy-body { grid-column: 2; grid-row: 2; }
  .policy > .toc {
    grid-column: 1;
    grid-row: 1 / span 2;
    position: sticky;
    top: 5rem;
    margin-top: 0.5rem;
    font-size: 0.9375rem;
    line-height: 1.375rem;
  }
}

@media print {
  .skip, .site-header, .toc { display: none; }
  body { font-size: 11pt; line-height: 1.45; }
  main, .site-footer { max-width: none; padding: 0; }
  a, a:visited { color: #000000; }
  main a[href]:not([href^="#"])::after { content: " (" attr(href) ")"; font-size: 90%; }
  .summary { background: none; border: 1px solid #999999; }
  h2, h3 { break-after: avoid; }
}
