/* Relos · legal doc shell — Cloud Grey paper, Navy ink, Teal accent. RELOS brand v1.0 (2026). */

:root {
  --bg:        #f5f7fa;
  --surface:   #ffffff;
  --surface-2: #eef2f7;
  --border:    #d8e0ea;
  --border-soft:#e7ecf3;
  --text:      #0b1f3b;
  --text-dim:  #1a3a5c;
  --muted:     #5a6d85;
  --muted-soft:#8ea0b8;
  --accent:    #2fa4a9;
  --accent-dim:#1f7d82;
  --accent-ink:#ffffff;
  --accent-soft:rgba(47,164,169,0.10);
  --accent-ring:rgba(47,164,169,0.32);
  --ok:        #b8924a;
  --warn:      #a8761e;
  --err:       #b54848;

  --font-ui:   "Inter Tight", Inter, -apple-system, system-ui, sans-serif;
  --font-serif:"Instrument Serif", "Iowan Old Style", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --rad-md: 10px;
  --rad-lg: 14px;
  --rad-xl: 20px;

  --sidebar-w: 300px;
  --max-body:  720px;
}

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

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

::selection { background: var(--accent-soft); color: var(--accent); }

/* ───────── Top bar ───────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 32px;
  background: rgba(245,247,250,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); font-weight: 600; font-size: 15px; letter-spacing: -0.3px;
}
/* Wordmark image used in place of the old inline-SVG mark + "Relos"
   text. The mark didn't match the app's actual wordmark (the SVG
   was a placeholder grid + chevron from the early design bundle),
   so the legal pages read as a separate product. Using the same
   /relos.png file the app's chrome serves keeps the brand
   consistent across surfaces. */
.topbar .brand-image {
  height: 24px;
  width: auto;
  display: block;
  flex-shrink: 0;
}
@media (max-width: 900px) {
  .topbar .brand-image { height: 20px; }
}

.topbar .actions { display: inline-flex; gap: 8px; align-items: center; }
.topbar .btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 8px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-dim); font-family: var(--font-ui); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: background 180ms ease, border-color 180ms ease;
}
.topbar .btn:hover { background: var(--surface); border-color: var(--muted-soft); color: var(--text); }
.topbar .btn.primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
}
.topbar .btn.primary:hover { background: var(--accent-dim); }

/* ───────── Layout ───────── */
.page {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 32px 120px;
  gap: 48px;
}
@media (max-width: 900px) {
  .page { grid-template-columns: 1fr; padding: 20px 20px 80px; gap: 20px; }
  .topbar { padding: 12px 16px; }
  .topbar .brand { font-size: 14px; }
  .topbar .btn { padding: 7px 10px; font-size: 12px; }
}
@media (max-width: 640px) {
  .page { padding: 16px 16px 80px; gap: 16px; }
  main.doc h1 { font-size: 36px !important; letter-spacing: -0.6px !important; line-height: 1.08 !important; }
  main.doc .lede { font-size: 15px !important; }
  main.doc .meta-strip { gap: 14px !important; padding: 14px 16px !important; margin-bottom: 32px !important; }
  main.doc .meta-strip > div { flex: 1 1 45%; min-width: 0; }
  main.doc section { margin-bottom: 36px !important; }
  main.doc section > h2 { font-size: 22px !important; gap: 10px !important; flex-wrap: wrap; }
  main.doc section > h2 .num { font-size: 11px !important; }
  main.doc section > .sub { padding-left: 0 !important; }
  main.doc .clause > li { padding-left: 34px; }
  main.doc .clause > li::before { width: 24px; font-size: 10px; }
  main.doc .t-wrap { margin: 14px -16px; border-radius: 0; border-left: none; border-right: none; }
  main.doc th, main.doc td { padding: 10px 12px; font-size: 12px; }
  main.doc .defs { grid-template-columns: 1fr; gap: 2px; }
  main.doc .defs dd { margin-bottom: 14px; }
  .doc-footer { padding: 28px 16px 40px; flex-direction: column; gap: 12px; }
  .doc-footer .links { flex-wrap: wrap; gap: 14px; }
}

/* ───────── Sidebar TOC ───────── */
aside.toc {
  position: sticky; top: 88px; align-self: start;
  max-height: calc(100vh - 110px); overflow: auto;
  padding-right: 12px;
  border-right: 1px solid var(--border-soft);
}
@media (max-width: 900px) {
  aside.toc {
    position: static; border-right: none; max-height: none; overflow: visible;
    padding-right: 0;
    padding: 16px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--rad-lg);
  }
  aside.toc details { cursor: pointer; }
  aside.toc > .toc-title { display: none; }
}

aside.toc .toc-title {
  font-size: 11px; font-weight: 600; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--accent); margin-bottom: 14px;
}
aside.toc ol {
  list-style: none; margin: 0; padding: 0;
  counter-reset: tocnum;
}
aside.toc li { margin: 0; }
aside.toc a {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 7px 10px; margin: 1px 0;
  border-radius: 7px;
  color: var(--muted); font-size: 13px; font-weight: 500; line-height: 1.4;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease;
}
aside.toc a::before {
  counter-increment: tocnum;
  content: counter(tocnum, decimal-leading-zero) ".";
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500; color: var(--muted-soft);
  flex-shrink: 0; padding-top: 1px;
}
aside.toc a:hover { color: var(--text-dim); background: var(--surface); }
aside.toc a.active {
  color: var(--accent); background: var(--accent-soft);
  border-left-color: var(--accent);
}
aside.toc a.active::before { color: var(--accent); }

/* ───────── Body ───────── */
main.doc {
  max-width: var(--max-body);
  min-width: 0;
}

main.doc .doc-meta {
  font-size: 11px; font-weight: 600; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

main.doc h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 56px; line-height: 1.05;
  letter-spacing: -1.2px;
  margin: 0 0 18px;
  color: var(--text);
  text-wrap: balance;
}

main.doc .lede {
  font-size: 17px; line-height: 1.6;
  color: var(--text-dim);
  max-width: 640px;
  margin: 0 0 32px;
  text-wrap: pretty;
}

main.doc .meta-strip {
  display: flex; flex-wrap: wrap; gap: 24px;
  padding: 16px 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--rad-lg);
  font-size: 12px; color: var(--muted);
  margin-bottom: 48px;
}
main.doc .meta-strip > div > span:first-child {
  display: block;
  font-size: 10px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--muted-soft);
  margin-bottom: 3px;
}
main.doc .meta-strip > div > span:last-child {
  color: var(--text); font-weight: 500;
}

main.doc section {
  margin: 0 0 48px;
  scroll-margin-top: 88px;
}

main.doc section > h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 28px; line-height: 1.2;
  letter-spacing: -0.4px;
  color: var(--text);
  margin: 0 0 6px;
  display: flex; align-items: baseline; gap: 14px;
}
main.doc section > h2 .num {
  font-family: var(--font-mono);
  font-size: 13px; font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.5px;
  flex-shrink: 0;
  padding-top: 2px;
}
main.doc section > .sub {
  margin: 0 0 20px 0;
  font-size: 13px; color: var(--muted);
  padding-left: 48px;
}

main.doc section > h3 {
  font-family: var(--font-ui);
  font-weight: 600; font-size: 14px;
  letter-spacing: -0.1px;
  color: var(--text);
  margin: 22px 0 8px;
}

main.doc p {
  margin: 0 0 14px;
  color: var(--text-dim);
  font-size: 14px; line-height: 1.7;
}
main.doc p strong { color: var(--text); font-weight: 600; }
main.doc p em { color: var(--text); font-style: normal; font-weight: 500; }

main.doc ul, main.doc ol {
  margin: 0 0 14px; padding-left: 22px;
  color: var(--text-dim); font-size: 14px; line-height: 1.7;
}
main.doc li { margin-bottom: 6px; }
main.doc li::marker { color: var(--muted-soft); }

main.doc .clause {
  counter-reset: clause;
  list-style: none; padding-left: 0;
}
main.doc .clause > li {
  counter-increment: clause;
  position: relative;
  padding-left: 44px;
  margin-bottom: 14px;
}
main.doc .clause > li::before {
  content: counter(clause, decimal-leading-zero);
  position: absolute; left: 0; top: 2px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  color: var(--muted-soft);
  width: 32px; text-align: right;
  padding-right: 4px; border-right: 1px solid var(--border);
}

main.doc .callout {
  padding: 16px 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--rad-md);
  font-size: 13px; color: var(--text-dim);
  margin: 18px 0;
  display: flex; gap: 14px; align-items: flex-start;
}
main.doc .callout .icon {
  width: 24px; height: 24px; border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
  font-family: var(--font-serif);
}
main.doc .callout p { margin: 0; }

/* Table */
main.doc .t-wrap { overflow-x: auto; margin: 18px 0; border-radius: var(--rad-lg); border: 1px solid var(--border); }
main.doc table {
  width: 100%; border-collapse: collapse; font-size: 13px;
  background: var(--surface);
}
main.doc th, main.doc td {
  padding: 12px 14px; text-align: left;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}
main.doc tr:last-child th, main.doc tr:last-child td { border-bottom: none; }
main.doc th {
  font-size: 10px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--muted); background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
main.doc td { color: var(--text-dim); }
main.doc td strong { color: var(--text); font-weight: 600; }
main.doc td code {
  font-family: var(--font-mono); font-size: 11px;
  padding: 2px 6px; border-radius: 4px;
  background: var(--surface-2); color: var(--accent);
  border: 1px solid var(--border);
}

main.doc .defs {
  display: grid; grid-template-columns: 180px 1fr; gap: 6px 18px;
  margin: 14px 0;
  font-size: 13px;
}
main.doc .defs dt {
  font-weight: 600; color: var(--text);
  font-family: var(--font-ui);
}
main.doc .defs dd {
  margin: 0 0 10px;
  color: var(--text-dim); line-height: 1.6;
}
@media (max-width: 700px) {
  main.doc .defs { grid-template-columns: 1fr; gap: 2px; }
  main.doc .defs dd { margin-bottom: 14px; }
}

/* Footer */
.doc-footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 32px 60px;
  border-top: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 12px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 20px;
}
.doc-footer a { color: var(--muted); text-decoration: none; }
.doc-footer a:hover { color: var(--text-dim); text-decoration: underline; text-underline-offset: 2px; }
.doc-footer .links { display: inline-flex; gap: 22px; }

/* ───────── Print ───────── */
@media print {
  :root { --bg: #ffffff; --surface: #ffffff; --surface-2: #f5f7fa; --border: #d8e0ea; --border-soft: #e7ecf3; --text: #0b1f3b; --text-dim: #1a3a5c; --muted: #5a6d85; --muted-soft: #8ea0b8; --accent: #1f7d82; --accent-dim: #155b5f; --accent-soft: #e3f2f3; --accent-ring: #b6dcde; --accent-ink: #fff; }
  body { background: #fff !important; color: #0b1f3b !important; font-size: 11pt; line-height: 1.55; }
  .topbar, aside.toc, .doc-footer .links, .skip-link { display: none !important; }
  .page { display: block; padding: 0; max-width: 100%; }
  main.doc { max-width: 100%; }
  main.doc h1 { font-size: 28pt; color: #0b1f3b; }
  main.doc section > h2 { font-size: 16pt; color: #0b1f3b; break-after: avoid; }
  main.doc p, main.doc li { color: #1a3a5c; }
  main.doc section { break-inside: avoid-page; margin-bottom: 20pt; }
  main.doc .callout, main.doc .meta-strip { border: 1px solid #d8e0ea !important; background: #f5f7fa !important; }
  main.doc .t-wrap { border: 1px solid #d8e0ea; }
  main.doc th { background: #eef2f7 !important; }
  a { color: #1f7d82 !important; text-decoration: underline; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #888; }
  .doc-footer { border-top: 1px solid #ccc; padding: 16pt 0 0; color: #555; }
}

.skip-link {
  position: absolute; left: -9999px;
}
.skip-link:focus {
  left: 16px; top: 16px; z-index: 999;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 16px; border-radius: 8px; font-weight: 600; font-size: 13px;
}
