/* Shared shell for Rentakoto's standalone policy pages
   (TERMS.html, PRIVACY.html, COOKIES.html, SECURITY.html).
   Tokens mirror frontend/app/globals.css so these pages read
   as part of the app, not a separate site. */

:root {
  --bg: #f9fafb;
  --surface: #ffffff;
  --ink: #111827;
  --body: #374151;
  --muted: #6b7280;
  --border: #e5e7eb;
  --brand: #4f46e5;
  --link: #4338ca;
  --brand-tint: #eef2ff;
  --callout-bg: #fffbeb;
  --callout-border: #fde68a;
  --callout-ink: #78350f;
  --table-head: #f3f4f6;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --bar-h: 60px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111827;
    --surface: #1f2937;
    --ink: #f9fafb;
    --body: #d1d5db;
    --muted: #9ca3af;
    --border: #374151;
    --brand: #818cf8;
    --link: #a5b4fc;
    --brand-tint: rgba(99, 102, 241, 0.16);
    --callout-bg: rgba(245, 158, 11, 0.09);
    --callout-border: rgba(245, 158, 11, 0.35);
    --callout-ink: #fde68a;
    --table-head: #273348;
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--bar-h) + 20px);
}

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

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  background: var(--bg);
  color: var(--body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .toc-title {
  font-family: "Poppins", "Inter", system-ui, sans-serif;
  color: var(--ink);
  text-wrap: balance;
}

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

/* ---- Top bar ---- */

.site-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-bar .brand { display: inline-flex; align-items: center; flex-shrink: 0; }
.site-bar .brand img { height: 30px; width: auto; border-radius: 8px; display: block; }

.policy-nav {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.policy-nav::-webkit-scrollbar { display: none; }

.policy-nav a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.policy-nav a:hover { color: var(--ink); text-decoration: none; }
.policy-nav a[aria-current="page"] {
  color: var(--brand);
  background: var(--brand-tint);
}

/* ---- Page grid ---- */

.page {
  max-width: 1060px;
  margin: 0 auto;
  padding: 40px 24px 88px;
}

@media (min-width: 1024px) {
  .page {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    gap: 56px;
    align-items: start;
  }
}

/* ---- On-this-page nav ---- */

.toc { font-size: 13.5px; }

.toc summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 600;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}
.toc[open] summary::after { transform: rotate(225deg); }

.toc ol {
  list-style: none;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc a {
  display: block;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  transition: color 0.15s ease, background-color 0.15s ease;
}
.toc a:hover { color: var(--ink); text-decoration: none; }
.toc a[aria-current="true"] {
  color: var(--brand);
  background: var(--brand-tint);
  font-weight: 500;
}

@media (max-width: 1023.98px) {
  .toc {
    margin-bottom: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    padding: 12px 16px;
  }
}

@media (min-width: 1024px) {
  .toc {
    position: sticky;
    top: calc(var(--bar-h) + 32px);
    max-height: calc(100vh - var(--bar-h) - 64px);
    overflow-y: auto;
    padding-right: 4px;
  }
  .toc summary { pointer-events: none; }
  .toc summary::after { display: none; }
}

/* ---- Document ---- */

.doc { max-width: 72ch; min-width: 0; }

.doc-header { padding-bottom: 28px; }

.doc-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 10px;
}

.doc-meta { color: var(--muted); font-size: 14px; }

.doc section {
  border-top: 1px solid var(--border);
  padding-top: 28px;
  margin-top: 28px;
}

.doc h2 {
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 14px;
}

.doc p { margin-bottom: 14px; text-wrap: pretty; }
.doc section > :last-child { margin-bottom: 0; }

.doc ul { padding-left: 22px; margin-bottom: 14px; }
.doc li { margin-bottom: 9px; }
.doc li::marker { color: var(--muted); }

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

.doc code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.875em;
  background: var(--table-head);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  color: var(--ink);
  overflow-wrap: anywhere;
}

/* Callout: full border + tint, no side-stripe */
.callout {
  background: var(--callout-bg);
  border: 1px solid var(--callout-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin: 14px 0;
  font-size: 0.95em;
  color: var(--callout-ink);
}
.callout strong { color: inherit; }

/* ---- Tables ---- */

.table-scroll {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 14px 0;
  background: var(--surface);
}

table { width: 100%; border-collapse: collapse; font-size: 0.9em; }

th {
  background: var(--table-head);
  color: var(--ink);
  text-align: left;
  font-weight: 600;
  padding: 10px 14px;
  white-space: nowrap;
}

td {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  vertical-align: top;
  min-width: 140px;
}

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

.site-foot {
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.site-foot a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.site-foot a:hover { color: var(--ink); }

/* ---- Print ---- */

@media print {
  .site-bar, .toc, .site-foot { display: none; }
  body { background: #fff; color: #000; }
  .doc { max-width: none; }
  .doc h1, .doc h2, .doc strong { color: #000; }
  a { color: #000; text-decoration: underline; }
}
