/* Niro legal pages — shared stylesheet.
   Tokens mirror index.html so the legal pages inherit the site's brand and theme. */

:root {
  /* Niro brand — dark (default) */
  --black: #060810;
  --black2: #0C1018;
  --black3: #121820;
  --border: #1E2530;
  --border2: #2D3748;
  --violet: #818CF8;
  --violet-glow: rgba(129,140,248,0.25);
  --cyan: #2DD4BF;
  --cyan-glow: rgba(45,212,191,0.22);
  --amber: #F6AD55;
  --danger: #F87171;
  --white: #EDF2F7;
  --mid: #9BAAB8;
  --dim: #5A6A7A;
  --grain-opacity: 0.025;
  --ff: 'DM Sans', sans-serif;
  --ff-heading: 'Space Grotesk', sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

:root[data-theme="light"] {
  --black: #FFFFFF;
  --black2: #F6F8FA;
  --black3: #EAEEF2;
  --border: #D0D7DE;
  --border2: #AFB8C1;
  --violet: #4F46E5;
  --violet-glow: rgba(79,70,229,0.18);
  --cyan: #0D9488;
  --cyan-glow: rgba(13,148,136,0.18);
  --amber: #D97706;
  --danger: #DC2626;
  --white: #0D1117;
  --mid: #57606A;
  --dim: #6E7781;
  --grain-opacity: 0.04;
}

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

html { scroll-behavior: smooth; }
body {
  background: var(--black);
  color: var(--white);
  font-family: var(--ff);
  font-size: 16.5px;
  line-height: 1.72;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s ease, color 0.4s ease;
}

/* Grain overlay, matching the home page texture */
body::after {
  content: '';
  position: fixed; inset: 0; z-index: 1000;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  mix-blend-mode: difference;
}

/* ---------- Top bar ---------- */
.lg-nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 20px;
  padding: 14px 32px;
  background: color-mix(in srgb, var(--black) 93%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.lg-nav .logo { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; }
.lg-nav .logo svg { display: block; }
.lg-nav-spacer { flex: 1; }
.lg-nav a.lg-home {
  font-family: var(--mono);
  font-size: 12.5px; letter-spacing: 0.02em;
  color: var(--mid); text-decoration: none;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}
.lg-nav a.lg-home:hover { color: var(--white); border-color: var(--violet); }

.theme-toggle {
  position: relative;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: var(--black2);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--mid);
  cursor: pointer;
  transition: border-color 0.2s var(--ease-out), color 0.2s var(--ease-out);
}
.theme-toggle:hover { color: var(--white); border-color: var(--violet); }
.theme-toggle svg {
  position: absolute; width: 16px; height: 16px;
  transition: opacity 0.3s var(--ease-out), transform 0.4s var(--ease-out);
}
.theme-toggle .icon-sun { opacity: 0; transform: rotate(-90deg) scale(0.5); }
.theme-toggle .icon-moon { opacity: 1; transform: rotate(0) scale(1); }
:root[data-theme="light"] .theme-toggle .icon-sun { opacity: 1; transform: rotate(0) scale(1); }
:root[data-theme="light"] .theme-toggle .icon-moon { opacity: 0; transform: rotate(90deg) scale(0.5); }

/* ---------- Layout ---------- */
.lg-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 56px 32px 96px;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

/* ---------- Sidebar ---------- */
.lg-side { position: sticky; top: 96px; }
.lg-side-title {
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 14px;
}
.lg-side ul { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.lg-side a {
  display: block;
  padding: 8px 12px;
  font-size: 14.5px;
  color: var(--mid); text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: color 0.18s var(--ease-out), background 0.18s var(--ease-out), border-color 0.18s var(--ease-out);
}
.lg-side a:hover { color: var(--white); background: var(--black2); }
.lg-side a[aria-current="page"] {
  color: var(--white);
  font-weight: 600;
  border-left-color: var(--cyan);
  background: var(--black2);
}

/* ---------- Document body ---------- */
.lg-doc { max-width: 760px; min-width: 0; }

.lg-doc h1 {
  font-family: var(--ff-heading);
  font-size: clamp(34px, 5vw, 48px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.08;
  margin-bottom: 10px;
}
.lg-updated {
  font-family: var(--mono);
  font-size: 12px; letter-spacing: 0.04em;
  color: var(--dim);
  padding-bottom: 28px;
  margin-bottom: 36px;
  border-bottom: 1px solid var(--border);
}

/* On-page contents — only rendered for the long contracts */
.lg-toc {
  margin: 0 0 44px;
  padding: 22px 26px 20px;
  background: var(--black2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.lg-toc-title {
  font-family: var(--mono);
  font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 14px;
}
.lg-toc ol {
  list-style: none;
  columns: 2; column-gap: 32px;
  margin: 0; padding: 0;
}
.lg-toc li { margin: 0 0 7px; break-inside: avoid; }
.lg-toc a {
  font-size: 14px;
  color: var(--mid); text-decoration: none;
  border-bottom: 0;
  transition: color 0.18s var(--ease-out);
}
.lg-toc a:hover { color: var(--violet); }

/* Headings carry ids for the contents links; keep them clear of the sticky bar */
.lg-doc h2[id], .lg-doc h3[id] { scroll-margin-top: 88px; }

.lg-doc h2 {
  font-family: var(--ff-heading);
  font-size: 26px; font-weight: 600;
  letter-spacing: -0.025em;
  margin: 52px 0 14px;
  padding-top: 8px;
}
.lg-doc h3 {
  font-family: var(--ff-heading);
  font-size: 19.5px; font-weight: 600;
  letter-spacing: -0.02em;
  margin: 36px 0 10px;
}
.lg-doc h4 {
  font-family: var(--ff-heading);
  font-size: 16.5px; font-weight: 600;
  color: var(--mid);
  margin: 26px 0 8px;
}
.lg-doc h2:first-child, .lg-doc h3:first-child { margin-top: 0; }

.lg-doc p { color: var(--mid); margin: 0 0 18px; }
.lg-doc strong { color: var(--white); font-weight: 600; }
.lg-doc em { font-style: italic; }

.lg-doc a {
  color: var(--violet);
  text-decoration: none;
  border-bottom: 1px solid var(--violet-glow);
  transition: border-color 0.18s var(--ease-out);
}
.lg-doc a:hover { border-bottom-color: var(--violet); }

.lg-doc ul, .lg-doc ol { color: var(--mid); margin: 0 0 20px; padding-left: 22px; }
.lg-doc li { margin-bottom: 8px; }
.lg-doc li > ul, .lg-doc li > ol { margin: 8px 0 0; }

.lg-doc blockquote {
  margin: 0 0 22px;
  padding: 14px 20px;
  border-left: 3px solid var(--cyan);
  background: var(--black2);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--mid);
}
.lg-doc blockquote p:last-child { margin-bottom: 0; }

.lg-doc hr { border: 0; border-top: 1px solid var(--border); margin: 44px 0; }

.lg-doc code {
  font-family: var(--mono);
  font-size: 0.87em;
  padding: 2px 6px;
  background: var(--black3);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--white);
}
.lg-doc pre {
  margin: 0 0 22px;
  padding: 16px 18px;
  background: var(--black2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
}
.lg-doc pre code { padding: 0; background: none; border: 0; font-size: 13px; line-height: 1.65; }

/* Tables — the legal docs lean on these heavily */
.lg-table-scroll { overflow-x: auto; margin: 0 0 26px; }
.lg-doc table {
  width: 100%;
  min-width: 460px;
  border-collapse: collapse;
  font-size: 14.5px;
  background: var(--black2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.lg-doc thead th {
  text-align: left;
  font-family: var(--mono);
  font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--dim);
  padding: 12px 16px;
  background: var(--black3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.lg-doc tbody td {
  padding: 12px 16px;
  color: var(--mid);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.lg-doc tbody tr:last-child td { border-bottom: 0; }
.lg-doc tbody tr:hover td { background: var(--black3); }
.lg-doc td strong { color: var(--white); }

/* Checklists rendered from "- [ ]" survive as plain text; keep inputs tidy if present */
.lg-doc input[type="checkbox"] { margin-right: 8px; accent-color: var(--cyan); }

/* ---------- Hub page cards ---------- */
.lg-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 16px;
  margin: 8px 0 32px;
}
.lg-card {
  display: block;
  padding: 22px 22px 20px;
  background: var(--black2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: border-color 0.22s var(--ease-out), transform 0.22s var(--ease-out), background 0.22s var(--ease-out);
}
.lg-card:hover {
  border-color: var(--violet);
  background: var(--black3);
  transform: translateY(-2px);
}
.lg-card-k {
  font-family: var(--mono);
  font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--cyan);
  display: block; margin-bottom: 10px;
}
.lg-card-t {
  font-family: var(--ff-heading);
  font-size: 18px; font-weight: 600; letter-spacing: -0.02em;
  color: var(--white);
  display: block; margin-bottom: 6px;
}
.lg-card-d { font-size: 14px; color: var(--mid); line-height: 1.55; }

/* ---------- Footer ---------- */
.lg-foot {
  border-top: 1px solid var(--border);
  padding: 28px 32px 40px;
  display: flex; flex-wrap: wrap; gap: 10px 22px;
  align-items: center; justify-content: center;
  font-size: 13px;
  color: var(--dim);
}
.lg-foot a { color: var(--dim); text-decoration: none; transition: color 0.18s var(--ease-out); }
.lg-foot a:hover { color: var(--white); }
.lg-foot .lg-foot-co { font-family: var(--mono); font-size: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .lg-wrap {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 36px 22px 72px;
  }
  .lg-side {
    position: static;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border);
  }
  .lg-side ul { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .lg-side a {
    border: 1px solid var(--border);
    border-left-width: 1px;
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 13.5px;
  }
  .lg-side a[aria-current="page"] { border-color: var(--cyan); }
  .lg-nav { padding: 12px 20px; }
  .lg-nav .logo svg { width: 84px; height: 37px; }
  .lg-toc ol { columns: 1; }
  body { font-size: 16px; }
}

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