/* ---------- Modern Legal Page (Two-Column, Sticky TOC) ---------- */
/* Inherits site color tokens; provides friendly font + spacing */
:root {
  --bg: #ffffff;
  --fg: #0b0d11;
  --muted: #5b6270;
  --border: #e5e7eb;
  --accent: #0ea5e9;
  --accent2: #6366f1;
  --accent-tint: rgba(14, 165, 233, .08);
}

html.dark {
  --bg: #0b0d11;
  --fg: #f3f4f6;
  --muted: #9aa1ad;
  --border: #1f2937;
  --accent: #818cf8;
  --accent2: #c084fc;
  --accent-tint: rgba(129, 140, 248, .14);
}

body {
  margin: 0;
}

.legal {
  background: var(--bg);
  color: var(--fg);
}

.legal .container {
  max-width: 1060px;
  margin: 0 auto;
  padding: clamp(2rem, 3vw, 3rem) 1rem;
}

.theme-toggle {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 60px;
  height: 28px;
  border-radius: 14px;
  background: var(--muted);
  border: none;
  cursor: pointer;
  transition: background 0.3s;
}

.theme-toggle::after {
  content: '🌞';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: transform 0.3s;
}

html.dark .theme-toggle {
  background: var(--accent);
}

html.dark .theme-toggle::after {
  content: '🌙';
  transform: translateX(32px);
}

.legal a {
  color: var(--accent);
}

/* Friendly, modern font just for the legal area */
.legal,
.legal * {
  font-family: "Plus Jakarta Sans", "Nunito", "Inter", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  gap: .4rem;
  align-items: center;
  color: var(--muted);
  font-size: .95rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}

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

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

.breadcrumb .sep {
  opacity: .6
}

/* Title area */
.legal h1 {
  font-size: clamp(2rem, 2.8vw + 1rem, 3rem);
  line-height: 1.1;
  margin: 3rem 0 .6rem;
  letter-spacing: -.01em;
}

.legal .updated {
  color: var(--muted);
  font-size: .98rem;
  margin: 0 0 1.8rem;
}

/* Grid layout */
.legal .grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 900px) {
  .legal .grid {
    grid-template-columns: 1fr;
  }
}

/* Sidebar (sticky) */
.toc {
  position: sticky;
  top: 1.25rem;
  align-self: start;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  background: linear-gradient(180deg, var(--bg), var(--accent-tint));
  z-index: 1100;
  pointer-events: auto;
}

.toc h3 {
  margin: 0 0 .6rem;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

.toc nav {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.toc a {
  display: block;
  padding: .45rem .6rem;
  border-radius: 10px;
  color: var(--fg);
  text-decoration: none;
  border: 1px solid transparent;
  font-size: .98rem;
}

.toc a:hover {
  background: var(--accent-tint);
}

.toc a.active {
  border-color: var(--accent);
  background: var(--accent-tint);
}

/* Content styles */
.content {
  min-width: 0;
}

.section {
  padding: 1.2rem 0;
  border: none;
  border-radius: 18px;
  background: linear-gradient(180deg, var(--bg), transparent);
}

.section+.section {
  margin-top: 1rem;
}

.section h2 {
  font-size: 1.6rem;
  margin: .1rem 0 .6rem;
}

.section h3 {
  font-size: 1.2rem;
  margin: 2rem 0 .4rem;
}

.section p {
  line-height: 1.75;
  margin: .4rem 0;
}

.section ul {
  margin: .4rem 0 1rem;
  padding-left: 1.25rem;
  line-height: 1.7;
}

.section li {
  margin: .2rem 0;
}

.kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .95em;
}

.tiny {
  font-size: .92rem;
  color: var(--muted);
}

/* Anchor scrolling offset if the site has a sticky header */
.section {
  scroll-margin-top: 80px;
}

/* Pills quick jump (mobile) */
.quicklinks {
  display: none;
  margin: 0 0 1rem;
  gap: .5rem;
  flex-wrap: wrap;
}

.quicklinks a {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .4rem .8rem;
  text-decoration: none;
  color: var(--fg);
}

.quicklinks a:hover {
  background: var(--accent-tint);
}

@media (max-width: 900px) {
  .quicklinks {
    display: flex;
  }
}

/* === Sticky pill footer nav === */
:root {
  --surface: rgba(255, 255, 255, 0.75);
  --chip-bg: #f3f4f6;
}

html.dark {
  --surface: rgba(11, 13, 17, 0.65);
  --chip-bg: rgba(255, 255, 255, 0.06);
}

/* keep the semantic footer clean */
footer.site-footer {
  background: transparent;
  border: 0;
  padding: 0;
}

/* the pill container */
.footer-pill {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 9999px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, .16),
    0 2px 6px rgba(0, 0, 0, .08);
  -webkit-backdrop-filter: saturate(120%) blur(8px);
  backdrop-filter: saturate(120%) blur(8px);
  z-index: 1000;
}

/* chip buttons */
.footer-pill .chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  gap: .5rem;
  padding: .65rem 1.1rem;
  border-radius: 9999px;
  background: var(--chip-bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, sans-serif;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  line-height: 1;
  transition: background .2s ease, transform .15s ease, box-shadow .2s ease, color .2s ease;
}

.footer-pill .chip:hover {
  background: #5F56DD;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, .12);
}

.footer-pill .chip.active {
  background: #0b0d11;  /* light mode: almost black */
  color: #ffffff;       /* white text for max readability */
  cursor: default;
  pointer-events: none;
  box-shadow: 0 6px 14px rgba(0,0,0,.12);
  font-weight: 700;
}

html.dark .footer-pill .chip.active {
  background: #f3f4f6;  /* dark mode: almost white */
  color: #0b0d11;       /* dark text for contrast */
}

.footer-pill .chip:active {
  transform: translateY(0);
  box-shadow: none;
}

.footer-pill .chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* mobile: comfy size but not full width */
@media (max-width: 640px) {
  .footer-pill {
    width: min(560px, calc(100% - 40px));
    justify-content: space-between;
    gap: 6px;
  }

  .footer-pill .chip {
    flex: 1 1 0;
    text-align: center;
    min-width: 0;
  }
}

/* Mobile: use short label for "Terms of Service" */
.footer-pill .label-short {
  display: none;
}

@media (max-width: 640px) {
  .footer-pill .label-full {
    display: none;
  }

  .footer-pill .label-short {
    display: inline;
  }
}

/* Mobile: move toggle to top left */
@media (max-width: 768px) {
  .theme-toggle {
    top: 1rem;
    right: auto;
    left: 1rem;
  }
}

/* LEGAL: reserve space for sticky pill footer (different for mobile vs non-mobile) */

/* Default (tablet/desktop) — smaller cushion */
:root {
  --footer-h: 8px;
  /* pill is effectively taller on mobile */
  --footer-pad: 14px;
  /* extra cushion so nothing peeks under */
}

main,
.legal,
.legal .container,
.legal .content {
  padding-bottom: calc(var(--footer-h) + var(--footer-pad));
}

/* Mobile — a bit taller and with safe-area inset */
@media (max-width: 640px) {
  :root {
    --footer-h: 24px;
    /* pill is effectively taller on mobile */
    --footer-pad: 14px;
    /* extra cushion so nothing peeks under */
  }

  main,
  .legal,
  .legal .container,
  .legal .content {
    padding-bottom: calc(var(--footer-h) + var(--footer-pad) + env(safe-area-inset-bottom));
  }
}
