/* =============================================================================
   Robyn Robot — Legal pages stylesheet
   Mirrors the web app's "Editorial Library" design system:
   Literata (serif headings), Source Sans 3 (body), sage/neutral palette.
   ========================================================================== */

:root {
  /* Brand palette (matches web/tailwind.config.ts) */
  --sage-50: #f1f5f0;
  --sage-100: #e2ebe0;
  --sage-300: #b9ccb4;
  --sage-500: #8ba888;
  --sage-600: #6f8d6c;
  --sage-700: #5a7257;
  --sage-800: #495d47;

  --neutral-150: #f8f8f7;
  --neutral-200: #efefee;
  --neutral-300: #e5e5e5;
  --neutral-400: #c9c9c7;
  --neutral-500: #9a9a97;
  --neutral-600: #6b6b68;
  --neutral-700: #474745;
  --neutral-800: #2c2c2c;

  --red-600: #c02626;

  --bg: var(--neutral-150);
  --fg: var(--neutral-800);
  --muted: var(--neutral-600);
  --border: var(--neutral-300);

  --maxw: 760px;
  --radius: 0.75rem;

  --font-serif: "Literata", Georgia, "Times New Roman", serif;
  --font-sans: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--sage-700);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--sage-800);
}

/* ----------------------------------------------------------------- Header -- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(248, 248, 247, 0.85);
  backdrop-filter: saturate(150%) blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header__inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-header__logo img {
  height: 30px;
  display: block;
}

.site-header__back {
  font-size: 0.95rem;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.site-header__back:hover {
  color: var(--fg);
}

.site-header__back::before {
  content: "←";
  margin-right: 0.4rem;
}

/* ------------------------------------------------------------------ Layout - */

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
}

.doc-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}

@media (min-width: 960px) {
  .doc-layout {
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 3.5rem;
  }
}

/* ------------------------------------------------------------ Doc heading -- */

.doc-head {
  margin-bottom: 2.5rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

.doc-head__eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sage-700);
  font-weight: 600;
  margin: 0 0 0.6rem;
}

.doc-head h1 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--neutral-800);
}

.doc-head__meta {
  margin-top: 0.9rem;
  font-size: 0.92rem;
  color: var(--muted);
}

/* --------------------------------------------------------- Table of contents */

.toc {
  font-size: 0.9rem;
}

@media (min-width: 960px) {
  .toc {
    position: sticky;
    top: 88px;
    align-self: start;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
  }
}

.toc__title {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--neutral-500);
  font-weight: 600;
  margin: 0 0 0.85rem;
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: toc;
}

.toc li {
  margin: 0;
}

.toc a {
  display: block;
  padding: 0.3rem 0 0.3rem 0.85rem;
  border-left: 2px solid var(--border);
  color: var(--muted);
  text-decoration: none;
  line-height: 1.35;
}

.toc a:hover {
  color: var(--fg);
  border-left-color: var(--sage-500);
}

.toc a.is-active {
  color: var(--sage-800);
  border-left-color: var(--sage-600);
  font-weight: 600;
}

/* --------------------------------------------------------------- Prose body */

.prose {
  max-width: var(--maxw);
}

.prose h2 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 2.75rem 0 1rem;
  padding-top: 0.5rem;
  scroll-margin-top: 90px;
  color: var(--neutral-800);
}

.prose h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.18rem;
  line-height: 1.3;
  margin: 2rem 0 0.75rem;
  scroll-margin-top: 90px;
  color: var(--neutral-800);
}

.prose p {
  margin: 0 0 1.1rem;
}

.prose ul {
  margin: 0 0 1.3rem;
  padding-left: 1.25rem;
}

.prose li {
  margin: 0 0 0.55rem;
  padding-left: 0.2rem;
}

.prose li::marker {
  color: var(--sage-600);
}

.prose ul ul {
  margin: 0.55rem 0 0.3rem;
}

.prose strong {
  font-weight: 600;
  color: var(--neutral-800);
}

.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0 1.5rem;
}

.prose em {
  color: var(--neutral-700);
}

/* The trailing "Document version / Last updated" lines */
.prose hr + p,
.prose hr + p + p {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

/* --------------------------------------------------------------- DPA table - */

.prose .table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.prose table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
  background: #fff;
}

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

.prose th:last-child,
.prose td:last-child {
  border-right: none;
}

.prose tbody tr:last-child td {
  border-bottom: none;
}

.prose thead th {
  background: var(--sage-50);
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--sage-800);
  border-bottom: 2px solid var(--sage-300);
  white-space: nowrap;
}

.prose tbody tr:nth-child(even) td {
  background: var(--neutral-150);
}

/* ---------------------------------------------------------- Index / landing */

.intro {
  max-width: var(--maxw);
  margin-bottom: 3rem;
}

.intro h1 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(2rem, 4.5vw, 2.8rem);
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 1rem;
}

.intro p {
  font-size: 1.08rem;
  color: var(--neutral-700);
  margin: 0;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  max-width: 880px;
}

@media (min-width: 720px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.doc-card {
  display: block;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.6rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    transform 0.15s ease;
}

.doc-card:hover {
  border-color: var(--sage-400, var(--sage-500));
  box-shadow: 0 6px 24px -12px rgba(73, 93, 71, 0.4);
  transform: translateY(-2px);
}

.doc-card__eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--sage-700);
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.doc-card h2 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1.25;
  margin: 0 0 0.5rem;
}

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

.doc-card__cta {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--sage-700);
}

.doc-card__cta::after {
  content: "→";
  margin-left: 0.4rem;
}

/* ------------------------------------------------------------------ Footer - */

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

.site-footer__inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  color: var(--muted);
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--fg);
  text-decoration: underline;
}

/* --------------------------------------------------------------- Embed mode */
/* Activated by ?embed=1 (set by legal.js) when the doc is opened from the web
   app's signup/subscription flow. Hides every link that would take the user
   out to the marketing site, leaving a self-contained document. */
.is-embed .site-header__back { display: none; }
.is-embed .site-header__logo { cursor: default; pointer-events: none; }
.is-embed .site-footer__links { display: none; }

/* ------------------------------------------------------------ Loading state */

.doc-loading {
  color: var(--muted);
  font-size: 0.95rem;
  padding: 2rem 0;
}

.doc-error {
  color: var(--red-600);
  font-size: 0.95rem;
  padding: 2rem 0;
}

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