/* ============================================================
   Peidus Labs — Legal pages
   Dark theme · brushed-silver accents · readable long-form
   ============================================================ */

:root {
  --bg: #08090b;
  --bg-soft: #0e0f13;
  --surface: #14151a;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.18);

  --text: #eef1f6;
  --muted: #a2a7b3;
  --faint: #63687a;

  --accent: #c9d0dc;
  --accent-2: #eef2f8;
  --grad: linear-gradient(115deg, #f6f8fc 0%, #c2cad8 22%, #8c95a6 46%, #e4e9f1 64%, #a7b0c0 84%, #f2f5fa 100%);

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;

  --maxw: 1180px;
  --pad: clamp(20px, 5vw, 72px);
  --radius: 16px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  background:
    radial-gradient(60vw 60vw at 85% -12%, rgba(206, 214, 228, 0.10), transparent 60%),
    radial-gradient(50vw 50vw at -5% 20%, rgba(150, 160, 178, 0.07), transparent 55%);
}
.grain {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }

/* ---------- Top bar ---------- */
.site-top {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px var(--pad);
  background: rgba(8, 9, 11, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand .mark {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--grad);
  color: #08090b;
  font-weight: 700;
  font-size: 16px;
}
.brand .tag {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  padding-left: 11px;
  border-left: 1px solid var(--line-strong);
}
.site-top nav a {
  font-size: 14px;
  color: var(--muted);
  transition: color .25s ease;
}
.site-top nav a:hover { color: var(--text); }

/* ---------- Shared type ---------- */
.eyebrow {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-2);
}
h1 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.04;
  background: var(--grad);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: sheen 7s ease-in-out infinite alternate;
}
@keyframes sheen { to { background-position: 100% center; } }

/* ---------- Index (document directory) ---------- */
.hero-grid {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(56px, 9vw, 104px) var(--pad) clamp(48px, 7vw, 88px);
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(40px, 6vw, 72px);
}
@media (min-width: 900px) {
  .hero-grid { grid-template-columns: 0.85fr 1.15fr; align-items: start; }
}
.hero-left h1 { font-size: clamp(38px, 6vw, 68px); margin: 18px 0 22px; }
.hero-left .lede { color: var(--muted); font-size: 18px; max-width: 44ch; }

.doc-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.doc-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 6px 20px;
  padding: 24px 6px;
  border-bottom: 1px solid var(--line);
  transition: padding-left .35s var(--ease), background .35s var(--ease);
}
.doc-row:hover { padding-left: 16px; background: linear-gradient(90deg, rgba(206,214,228,0.05), transparent 65%); }
.doc-row .num {
  grid-row: span 2;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--faint);
  transition: color .35s ease;
}
.doc-row:hover .num { color: var(--accent-2); }
.doc-row .app { font-family: var(--font-display); font-weight: 500; font-size: 19px; letter-spacing: -0.01em; }
.doc-row .links { display: flex; flex-wrap: wrap; gap: 18px; }
.doc-row .links a {
  font-size: 14.5px;
  color: var(--muted);
  position: relative;
  transition: color .25s ease;
}
.doc-row .links a::after {
  content: ""; position: absolute; left: 0; bottom: -3px;
  width: 0; height: 1px; background: var(--accent-2); transition: width .3s var(--ease);
}
.doc-row .links a:hover { color: var(--text); }
.doc-row .links a:hover::after { width: 100%; }

/* ---------- Document pages ---------- */
.doc-grid {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(40px, 6vw, 72px) var(--pad) clamp(64px, 9vw, 120px);
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(32px, 5vw, 64px);
}
@media (min-width: 900px) {
  .doc-grid { grid-template-columns: 240px 1fr; align-items: start; }
}

.toc { position: relative; }
@media (min-width: 900px) {
  .toc { position: sticky; top: 96px; }
}
.toc-title {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 16px;
}
.toc ol { list-style: none; counter-reset: toc; display: flex; flex-direction: column; gap: 2px; }
.toc li { counter-increment: toc; }
.toc a {
  display: block;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--muted);
  border-left: 2px solid transparent;
  transition: color .2s ease, background .2s ease, border-color .2s ease;
}
.toc a:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.toc a.is-active {
  color: var(--text);
  background: rgba(255,255,255,0.04);
  border-left-color: var(--accent-2);
}
.related {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--faint);
}
.related a { color: var(--accent-2); }
.related a:hover { text-decoration: underline; }

article { min-width: 0; max-width: 74ch; }
.doc-head { margin-bottom: 40px; padding-bottom: 32px; border-bottom: 1px solid var(--line); }
.doc-head .eyebrow { display: block; margin-bottom: 16px; }
.doc-head h1 { font-size: clamp(32px, 5vw, 52px); }
.doc-head .meta {
  margin-top: 18px;
  font-family: var(--font-body);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
}

article h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(20px, 3vw, 26px);
  letter-spacing: -0.01em;
  margin: 44px 0 14px;
  scroll-margin-top: 96px;
  color: var(--text);
}
article h2 em { font-style: italic; background: none; color: var(--accent-2); }
article p { color: #c7ccd6; margin: 0 0 16px; }
article ul { margin: 0 0 18px; padding-left: 22px; color: #c7ccd6; }
article li { margin-bottom: 8px; }
article strong { color: var(--text); font-weight: 600; }
article a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--line-strong); transition: text-decoration-color .2s ease; }
article a:hover { text-decoration-color: var(--accent-2); }

/* ---------- Footer ---------- */
.site-foot {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 32px var(--pad) 56px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  color: var(--faint);
  font-size: 13px;
}
.site-foot .mono { font-family: var(--font-display); color: var(--muted); }
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--text); }
.site-foot > *:last-child { margin-left: auto; }

/* ---------- Entrance ---------- */
.rise {
  opacity: 0;
  transform: translateY(16px);
  animation: rise .7s var(--ease) forwards;
  animation-delay: calc(var(--i, 0) * 70ms);
}
@keyframes rise { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .rise { opacity: 1 !important; transform: none !important; }
  html { scroll-behavior: auto; }
  h1 { color: var(--accent-2); }
}

@media (max-width: 560px) {
  .site-foot > *:last-child { margin-left: 0; }
  .doc-row { grid-template-columns: auto 1fr; }
}
