/* Diligica legal pages: privacy, terms, accessibility and 404.
   Self-contained: system fonts only, no imported sheets, no external resources.
   Colors are copied from the landing page tokens (page paper at rest, ink, terracotta).
   Contrast on the paper (#ffffe6): ink 13.4:1, ink-body 8.4:1, ink-muted 5.6:1,
   terracotta-ink links 7.8:1. On the summary box (#eeecd7): ink-body 7.1:1,
   ink-muted 4.7:1, links 6.6:1. All text pairs meet WCAG 2.1 AA (4.5:1). */

:root {
  --page-paper: #ffffe6;
  --vellum-mid: #eeecd7;
  --ink: #302e24;
  --ink-body: #514d3d;
  --ink-muted: #6c6758;
  --terracotta: #9c4b36;
  --terracotta-ink: #853b2a;
  --rule: #c9bea6;
  --rule-soft: #ddd2b9;
  --font-body: Garamond, "EB Garamond", "Iowan Old Style", Georgia, serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --measure: 44rem;
  --wide: 64rem;
  --gutter: 1rem;
  color-scheme: light;
}

*,
*::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(--page-paper);
  color: var(--ink-body);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

@media (min-width: 48rem) {
  body {
    font-size: 1.1875rem;
  }
}

img {
  max-width: 100%;
}

/* Links: always underlined in running text, never colour alone. */
a {
  color: var(--terracotta-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--ink);
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--terracotta-ink);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: #ecd6cb;
  color: var(--ink);
}

/* Skip link: off screen until it receives keyboard focus. */
.skip-link {
  position: absolute;
  top: 0.75rem;
  left: var(--gutter);
  z-index: 10;
  padding: 0.75rem 1rem;
  border: 1px solid var(--ink);
  background: var(--page-paper);
  color: var(--ink);
  font: 600 0.9375rem/1.2 var(--font-ui);
  transform: translateY(-300%);
}

.skip-link:focus {
  transform: none;
}

/* Header and footer */
.site-header {
  border-bottom: 1px solid var(--rule-soft);
}

.site-header-inner,
.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 1rem var(--gutter);
}

.brand {
  display: inline-flex;
}

.brand img {
  display: block;
  height: 48px;
  width: auto;
  aspect-ratio: 2061 / 763;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav li {
  margin: 0;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink-body);
  font: 500 0.8125rem/1.2 var(--font-ui);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--terracotta-ink);
  text-decoration: underline;
}

.site-nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--terracotta);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.5em;
}

.site-footer {
  margin-top: 2rem;
  border-top: 1px solid var(--rule-soft);
}

.site-footer-inner {
  padding-top: 1.5rem;
  padding-bottom: 2.5rem;
  color: var(--ink-muted);
  font: 400 0.875rem/1.5 var(--font-ui);
}

.site-footer p {
  margin: 0;
}

/* Main column */
main {
  display: block;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.5rem var(--gutter) 3rem;
}

h1,
h2,
h3 {
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(2.25rem, 1.6rem + 3vw, 3.25rem);
}

h2 {
  margin: 3rem 0 0.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule-soft);
  font-size: clamp(1.5rem, 1.3rem + 1vw, 1.875rem);
}

h3 {
  margin: 2rem 0 0.5rem;
  font-size: 1.4375rem;
}

h2,
h3 {
  scroll-margin-top: 1rem;
}

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

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

li {
  margin-bottom: 0.4rem;
}

li::marker {
  color: var(--ink-muted);
}

strong {
  color: var(--ink);
  font-weight: 700;
}

code {
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--ink-muted);
  font: 500 0.8125rem/1.4 var(--font-ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-meta {
  margin: 0 0 1.5rem;
  color: var(--ink-muted);
  font: 400 0.9375rem/1.5 var(--font-ui);
}

.lede {
  color: var(--ink);
  font-size: 1.1875rem;
}

@media (min-width: 48rem) {
  .lede {
    font-size: 1.3125rem;
  }
}

/* "The short version" and other call-outs */
.summary {
  margin: 2rem 0;
  padding: 1.25rem 1rem 0.5rem;
  border-left: 4px solid var(--terracotta);
  border-radius: 2px;
  background: var(--vellum-mid);
}

@media (min-width: 30rem) {
  .summary {
    padding: 1.5rem 1.5rem 0.75rem;
  }
}

.summary h2 {
  margin: 0 0 0.75rem;
  padding: 0;
  border: 0;
  font-size: 1.5rem;
}

/* Table of contents */
.toc {
  margin: 2rem 0 1rem;
  padding: 1rem 0 0.5rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.toc h2 {
  margin: 0 0 0.5rem;
  padding: 0;
  border: 0;
  color: var(--ink-muted);
  font: 600 0.8125rem/1.4 var(--font-ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toc ul {
  margin: 0 0 0.5rem;
  padding: 0;
  list-style: none;
  font-size: 1.0625rem;
}

.toc li {
  margin: 0;
  padding: 0.2rem 0;
  break-inside: avoid;
}

/* The contents box already ends with a rule; don't double it on the first section. */
.toc + section > h2:first-child {
  margin-top: 2.5rem;
  padding-top: 0;
  border-top: 0;
}

@media (min-width: 40rem) {
  .toc ul {
    columns: 2;
    column-gap: 2.5rem;
  }
}

/* Category details: label / value pairs */
.facts {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin: 0 0 1.5rem;
}

.facts dt {
  margin-top: 0.75rem;
  color: var(--ink-muted);
  font: 600 0.8125rem/1.4 var(--font-ui);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.facts dd {
  margin: 0.15rem 0 0;
}

@media (min-width: 40rem) {
  .facts {
    grid-template-columns: 8.5rem minmax(0, 1fr);
    gap: 0.6rem 1.25rem;
  }

  .facts dt {
    margin-top: 0.3rem;
  }

  .facts dd {
    margin: 0;
  }
}

/* Tables (retention schedule) */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.0625rem;
}

caption {
  padding-bottom: 0.5rem;
  color: var(--ink-muted);
  font: 600 0.8125rem/1.4 var(--font-ui);
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}

th,
td {
  padding: 0.65rem 0.75rem 0.65rem 0;
  border-bottom: 1px solid var(--rule-soft);
  text-align: left;
  vertical-align: top;
}

thead th {
  border-bottom-color: var(--rule);
  color: var(--ink-muted);
  font: 600 0.8125rem/1.4 var(--font-ui);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

tbody th {
  width: 40%;
  color: var(--ink);
  font-weight: 700;
}

.to-top {
  margin-top: 3rem;
  font: 400 0.9375rem/1.5 var(--font-ui);
}

.effective {
  margin-top: 2.5rem;
  color: var(--ink-muted);
  font: 400 0.9375rem/1.5 var(--font-ui);
}

/* 404 */
.not-found {
  padding-top: 4rem;
  padding-bottom: 5rem;
}

.not-found ul {
  padding-left: 1.25rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }

  .skip-link,
  .site-nav,
  .toc,
  .to-top {
    display: none;
  }

  a {
    color: #000;
  }

  main a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 90%;
  }

  .summary {
    border: 1px solid #000;
    background: none;
  }

  h2,
  h3 {
    break-after: avoid;
  }
}
