/* fonts.css is linked ahead of this file in base.njk, not @imported,
   so the two stylesheets download in parallel. */

/* ---------------------------------------------------------------
   Interu brand tokens, sampled from interu.io
   --------------------------------------------------------------- */
:root {
  --ink: #000000;
  --ink-soft: #262626;
  /* Interu sets label grey at #999; darkened here to #6b6b6b so small
     text clears WCAG AA (5.3:1) on a document people must be able to read. */
  --label: #6b6b6b;
  --body: #333333;
  --line: #e5e5e5;
  --surface: #f2f2f2;
  --paper: #ffffff;

  --green: #005e21;
  --green-bright: #00993a;
  --green-wash: #eef4ef;
  --coral: #f89372;

  --display: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --text: "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", monospace;

  /* Content sits in a single centred column at a readable measure;
     the header and footer run wider so the brand anchors the top-left,
     the way it does on interu.io. */
  --shell: 68rem;
  --shell-wide: 74rem;
  --radius: 12px;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--body);
  font-family: var(--text);
  font-size: 1rem;
  line-height: 1.7;
  letter-spacing: -0.011em;
  font-feature-settings: "cv05" 1;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 2rem;
}

/* Documents are for reading: hold a comfortable measure. The index is not
   a document, so its card grid uses the full column. */
.main-col > article {
  max-width: 42rem;
}

a {
  color: var(--ink);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--line);
  transition: text-decoration-color 0.15s ease, color 0.15s ease;
}

a:hover {
  text-decoration-color: currentColor;
}

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

/* ---------------------------------------------------------------
   Signature device: mono label preceded by a status dot.
   The dot's colour carries the document's legal state, so the brand
   mark does real work rather than decorating.
   --------------------------------------------------------------- */
.label {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--label);
  margin: 0;
}

.label::before {
  content: "";
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background: var(--dot, var(--coral));
  flex: none;
}

.label--bare::before {
  display: none;
}

.is-current {
  --dot: var(--green-bright);
}
.is-upcoming {
  --dot: var(--coral);
}
.is-superseded {
  --dot: #c4c4c4;
}

/* ---------------------------------------------------------------
   Header / footer
   --------------------------------------------------------------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.site-header .container,
.site-footer .container {
  max-width: var(--shell-wide);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 4.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
}

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

.brand-divider {
  width: 1px;
  height: 1.6rem;
  background: var(--line);
}

.brand-suffix {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--label);
}

main {
  display: block;
  padding: 4rem 0 6rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 2rem 0 3rem;
  color: var(--label);
  font-size: 0.85rem;
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  justify-content: space-between;
}

.site-footer a {
  color: var(--label);
}

/* ---------------------------------------------------------------
   Typography
   --------------------------------------------------------------- */
h1,
h2,
h3,
h4 {
  scroll-margin-top: 2rem;
  font-family: var(--display);
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  text-wrap: balance;
}

h1 {
  font-size: clamp(1.9rem, 1.4rem + 1.6vw, 2.6rem);
  margin: 0.75rem 0 0;
}

h2 {
  font-size: 1.4rem;
  margin: 3rem 0 1rem;
}

h3 {
  font-size: 1.1rem;
  margin: 2.25rem 0 0.75rem;
}

p,
li {
  text-wrap: pretty;
}

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

.lede {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--body);
  margin: 1.25rem 0 0;
}

/* ---------------------------------------------------------------
   Index: document list
   --------------------------------------------------------------- */
.page-head {
  margin-bottom: 4rem;
}

.doc-group + .doc-group {
  margin-top: 3rem;
}

.doc-group > .label {
  margin-bottom: 1rem;
}

.doc-cards {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1rem;
}

.doc-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 0.5rem;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.doc-card:hover {
  border-color: var(--ink);
  background: var(--bg-tint, transparent);
}

.doc-card h2 {
  font-size: 1.15rem;
  margin: 0;
}

.doc-card p {
  margin: 0;
  color: var(--body);
  font-size: 0.95rem;
}

.doc-card .label {
  margin-top: auto;
  padding-top: 0.75rem;
}

/* ---------------------------------------------------------------
   Shell: the document navigator sits beside the content on wide
   screens and collapses to a disclosure above it on narrow ones.
   --------------------------------------------------------------- */
.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
}

.main-col {
  min-width: 0;
}

.docnav {
  font-size: 0.9rem;
}

.docnav-group {
  margin: 1.75rem 0 0.6rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--label);
}

.docnav nav > .docnav-group:first-child {
  margin-top: 0;
}

.docnav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.docnav > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}

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

.docnav > summary::after {
  content: "+";
  font-size: 1rem;
  color: var(--label);
}

.docnav[open] > summary::after {
  content: "\2212";
}

.docnav nav {
  margin-top: 1rem;
}

/* Document entries */
.docnav ul > li > a {
  display: block;
  padding: 0.35rem 0 0.35rem 0.9rem;
  border-left: 2px solid var(--line);
  color: var(--body);
  text-decoration: none;
  line-height: 1.45;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.docnav ul > li > a:hover {
  color: var(--ink);
  border-left-color: var(--label);
}

.docnav ul > li > a[aria-current] {
  color: var(--ink);
  font-weight: 600;
  border-left-color: var(--green);
}

/* ---------------------------------------------------------------
   Contents, inside the document itself
   --------------------------------------------------------------- */
.doc-toc {
  margin: 0 0 3rem;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.doc-toc > .label {
  margin-bottom: 0.9rem;
}

.doc-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.95rem;
}

/* A section and its subsections stay together in one column. */
.doc-toc > ol > li {
  break-inside: avoid;
}

.doc-toc a {
  display: block;
  padding: 0.22rem 0;
  color: var(--body);
  text-decoration: none;
  line-height: 1.45;
}

.doc-toc a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.doc-toc .toc-l2 > a {
  color: var(--ink);
  font-weight: 500;
}

.doc-toc > ol > li + li {
  margin-top: 0.6rem;
}

.doc-toc .toc-l3 a {
  padding-left: 1.1rem;
  font-size: 0.9rem;
}

/* Long contracts get two columns so the contents don't push the
   document itself off the first screen. */
@media (min-width: 48rem) {
  /* Only the outer list flows into columns; nested subsection lists must
     not, or they get shredded across the gutter. */
  .doc-toc > ol {
    columns: 2;
    column-gap: 2.5rem;
  }
}

@media (min-width: 64rem) {
  .shell {
    grid-template-columns: 16rem minmax(0, 1fr);
    gap: 4rem;
    align-items: start;
  }

  .docnav {
    position: sticky;
    top: 2.5rem;
    max-height: calc(100vh - 5rem);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .docnav > summary {
    display: none;
  }

  .docnav nav {
    margin-top: 0;
  }
}

/* ---------------------------------------------------------------
   Document pages
   --------------------------------------------------------------- */
.doc-actions {
  margin: 1.25rem 0 0;
  font-size: 0.92rem;
}

.doc-actions a {
  font-weight: 500;
  text-decoration-color: var(--line);
}

.doc-header {
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 3rem;
}

.doc-header .permalink {
  margin: 1.5rem 0 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--label);
  word-break: break-word;
}

.doc-header .permalink a {
  color: var(--label);
  text-decoration-color: var(--line);
}

.document > h2:first-of-type {
  margin-top: 0;
}

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

.document li + li {
  margin-top: 0.4rem;
}

.document blockquote {
  margin: 1.75rem 0;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--coral);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--ink-soft);
}

.document blockquote > :first-child {
  margin-top: 0;
}
.document blockquote > :last-child {
  margin-bottom: 0;
}

/* Clause anchors: legal text gets cited by section, so every heading
   is addressable. The marker stays hidden until hover or focus. */
.heading-anchor {
  margin-left: 0.4em;
  font-family: var(--mono);
  font-weight: 400;
  color: var(--label);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

h2:hover .heading-anchor,
h3:hover .heading-anchor,
.heading-anchor:focus-visible {
  opacity: 1;
}

/* ---------------------------------------------------------------
   Tables
   --------------------------------------------------------------- */
.table-scroll {
  overflow-x: auto;
  margin: 1.75rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

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

thead th {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--label);
  border-bottom-color: var(--ink);
  padding-top: 0;
}

/* ---------------------------------------------------------------
   Status banners
   --------------------------------------------------------------- */
.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 2.5rem;
  font-size: 0.92rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
}

.banner strong {
  font-weight: 600;
}

.banner a {
  font-weight: 500;
}

.banner--upcoming {
  background: var(--green-wash);
  border-color: #cfe0d4;
}

/* ---------------------------------------------------------------
   Archives
   --------------------------------------------------------------- */
.main-col > article.wide {
  max-width: none;
}

.archive-group + .archive-group {
  margin-top: 4rem;
}

.archive-group > h2 {
  margin: 0 0 0.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--ink);
  font-size: 1.3rem;
}

.archive-doc {
  scroll-margin-top: 2rem;
  padding-top: 1.75rem;
}

.archive-doc > h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.archive-doc > h3 a {
  text-decoration: none;
}

.archive-doc > h3 a:hover {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

/* ---------------------------------------------------------------
   Version history table
   --------------------------------------------------------------- */
.version-table .date {
  font-family: var(--mono);
  font-size: 0.85rem;
  white-space: nowrap;
}

.version-table .changes {
  color: var(--body);
}

.version-table .version-no {
  display: block;
  margin-top: 0.15rem;
  color: var(--label);
  font-size: 0.78rem;
}

.version-table td.status {
  white-space: nowrap;
}

/* ---------------------------------------------------------------
   Responsive
   --------------------------------------------------------------- */
@media (max-width: 40rem) {
  .container {
    padding: 0 1.25rem;
  }

  main {
    padding: 2.5rem 0 4rem;
  }

  .doc-card {
    grid-template-columns: 1fr;
  }

  .doc-card .label {
    grid-column: 1;
    grid-row: auto;
    order: -1;
    margin-bottom: 0.35rem;
  }

  .version-table,
  .version-table thead,
  .version-table tbody,
  .version-table tr,
  .version-table td,
  .version-table th {
    display: block;
  }

  .version-table thead {
    display: none;
  }

  .version-table tr {
    padding: 1.1rem 0;
    border-bottom: 1px solid var(--line);
  }

  .version-table td {
    border: 0;
    padding: 0;
  }

  .version-table td.status {
    margin: 0.35rem 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* ---------------------------------------------------------------
   Print: these documents get filed and signed off on paper.
   --------------------------------------------------------------- */
@media print {
  .site-header,
  .site-footer,
  .docnav,
  .doc-actions,
  .banner,
  .heading-anchor {
    display: none !important;
  }

  /* The contents list is worth keeping on paper, but not its box. */
  .doc-toc {
    border: 0;
    background: none;
    padding: 0;
    break-after: page;
  }

  .shell {
    display: block;
  }

  .main-col > article {
    max-width: none;
  }

  body {
    color: #000;
    font-size: 11pt;
  }

  main {
    padding: 0;
  }

  .container {
    max-width: none;
    padding: 0;
  }

  .reading {
    max-width: none;
  }

  a {
    text-decoration: none;
  }

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

  table,
  blockquote {
    break-inside: avoid;
  }
}
