/*
 * ==========================================================================
 * LEGAL TERMINAL — Privacy, Terms, Accessibility
 * Scoped to .lp / .lp-* so it doesn't collide with home, blog or post styles.
 * Uses TP brand tokens declared inside the .lp scope (self-contained).
 * ==========================================================================
 */

.lp {
  /* Reuse the same brand tokens as the rest of the TP chrome */
  --tp-bg:        #0A0907;
  --tp-ink:       #F2EBDC;
  --tp-mostaza:   #E8B923;
  --tp-terracota: #D9480F;
  --tp-verde:     #9CB380;
  --tp-rule:      rgba(242, 235, 220, 0.18);
  --tp-rule-soft: rgba(242, 235, 220, 0.12);
  --tp-rule-faint: rgba(242, 235, 220, 0.08);
  --tp-mute:      rgba(242, 235, 220, 0.55);
  --tp-mono:  'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --tp-sans:  'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --tp-serif: 'Instrument Serif', 'EB Garamond', Georgia, serif;
  --lp-gutter: 40px;

  background: var(--tp-bg);
  color: var(--tp-ink);
  font-family: var(--tp-mono);
  font-size: 14px;
  line-height: 1.55;
  position: relative;
  overflow-x: clip;
}

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

.lp a { color: inherit; text-decoration: none; }
.lp a:hover { color: var(--tp-mostaza); }

/* Reset stray legacy rules */
.lp section { background-color: transparent; text-align: left; margin: 0; }
.lp h1, .lp h2, .lp h3, .lp h4 { border: 0; padding: 0; margin: 0; font-weight: 400; color: var(--tp-ink); }

.lp-grain {
  position: absolute; inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(242,235,220,0.04) 1px, transparent 0);
  background-size: 4px 4px;
  pointer-events: none;
  z-index: 0;
}
.lp > section,
.lp > nav,
.lp > div { position: relative; z-index: 1; }

/* ==========================================================================
   Helpers
   ========================================================================== */
.lp-eyebrow {
  font-family: var(--tp-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.5;
}
.lp-accent { color: var(--tp-mostaza); }
.lp-sep    { margin: 0 10px; opacity: 0.3; }
.lp-mute   { opacity: 0.55; }

.lp-cursor {
  display: inline-block;
  width: 0.35em;
  height: 0.85em;
  background: var(--tp-mostaza);
  vertical-align: -0.05em;
  margin-left: 8px;
  animation: lp-blink 1.1s steps(2) infinite;
}
@keyframes lp-blink { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .lp-cursor { animation: none; } }

/* ==========================================================================
   Breadcrumb
   ========================================================================== */
.lp-breadcrumb {
  padding: 24px var(--lp-gutter);
  border-bottom: 1px solid var(--tp-rule-soft);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; opacity: 0.7;
  font-family: var(--tp-mono);
}

/* ==========================================================================
   Hero
   ========================================================================== */
.lp-hero { padding: 80px var(--lp-gutter) 40px; }

.lp-eyebrow-row {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  margin-bottom: 60px;
  font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; opacity: 0.5;
  font-family: var(--tp-mono);
}

.lp-h1 {
  font-family: var(--tp-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(72px, 14vw, 200px);
  line-height: 0.92;
  letter-spacing: -0.03em;
  margin: 16px 0 40px;
  text-transform: lowercase;
  color: var(--tp-ink);
  max-width: 100%;
  overflow-wrap: break-word;
}

.lp-lead {
  margin-top: 40px;
  max-width: 720px;
  font-family: var(--tp-sans);
  font-size: 18px;
  line-height: 1.55;
  opacity: 0.85;
}

/* ==========================================================================
   Tabs (3 docs)
   ========================================================================== */
.lp-tabs {
  margin: 0 var(--lp-gutter) 40px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--tp-rule);
}

.lp-tab {
  padding: 24px 28px;
  display: flex; flex-direction: column; gap: 8px;
  border-right: 1px solid var(--tp-rule);
  text-decoration: none;
  color: var(--tp-ink);
  transition: background 120ms ease;
}

.lp-tab:last-child { border-right: none; }
.lp-tab:hover { background: rgba(232, 185, 35, 0.05); }
.lp-tab.is-active { background: rgba(232, 185, 35, 0.08); }
.lp-tab.is-active .lp-eyebrow { color: var(--tp-mostaza); opacity: 1; }
.lp-tab.is-active .lp-tab-title { color: var(--tp-mostaza); }

.lp-tab-title {
  font-family: var(--tp-serif);
  font-style: italic;
  font-size: 40px;
  line-height: 1;
}

.lp-tab-sub {
  font-family: var(--tp-mono);
  font-size: 12px;
  opacity: 0.55;
}

/* ==========================================================================
   Body — TOC + prose
   ========================================================================== */
.lp-body {
  padding: 40px var(--lp-gutter) 80px;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 80px;
  align-items: start;
}

/* TOC */
.lp-toc {
  position: sticky;
  top: 100px;
  font-family: var(--tp-mono);
}

.lp-toc-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: flex; flex-direction: column; gap: 10px;
}

.lp-toc-list a {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  font-size: 12px;
  line-height: 1.5;
  opacity: 0.7;
  text-decoration: none;
  color: var(--tp-ink);
  transition: opacity 120ms ease, color 120ms ease;
}

.lp-toc-list a:hover { opacity: 1; color: var(--tp-mostaza); }
.lp-toc-num   { opacity: 0.4; }
.lp-toc-label { min-width: 0; }

.lp-toc-note {
  margin-top: 40px;
  padding: 16px;
  border: 1px solid var(--tp-rule);
  font-size: 11px;
  line-height: 1.6;
  opacity: 0.6;
  font-family: var(--tp-mono);
}

/* Prose */
.lp-prose { max-width: 640px; min-width: 0; }

.lp-section { margin-bottom: 56px; scroll-margin-top: 100px; }

.lp-section-head {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 32px;
}

.lp-section-num {
  font-family: var(--tp-serif);
  font-style: italic;
  font-size: 32px;
  line-height: 1;
  color: var(--tp-mostaza);
}

.lp-section-title {
  font-family: var(--tp-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.1;
  margin: 0;
  min-width: 0;
  color: var(--tp-ink);
  overflow-wrap: anywhere;
}

.lp-section-body {
  font-family: var(--tp-sans);
  font-size: 17px;
  line-height: 1.7;
  color: var(--tp-ink);
  overflow-wrap: anywhere;
}

.lp-section-body p { margin: 0 0 1.2em; }
.lp-section-body strong { font-weight: 600; }
.lp-section-body em { font-style: italic; }

.lp-section-body code {
  font-family: var(--tp-mono);
  background: rgba(242, 235, 220, 0.06);
  padding: 2px 6px;
  font-size: 0.9em;
  border-radius: 2px;
}

.lp-section-body a {
  color: var(--tp-mostaza);
  border-bottom: 1px solid rgba(232, 185, 35, 0.4);
  word-break: break-word;
}

.lp-section-body a:hover { border-bottom-color: var(--tp-mostaza); }

.lp-section-body ul,
.lp-section-body ol { padding-left: 1.5em; margin: 0 0 1.2em; }
.lp-section-body li { margin-bottom: 0.5em; }

.lp-section--extra {
  border-top: 1px solid var(--tp-rule-soft);
  padding-top: 32px;
}

.lp-doc-end {
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--tp-rule);
  font-family: var(--tp-mono);
  font-size: 12px;
  opacity: 0.5;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* ==========================================================================
   Prev / Next
   ========================================================================== */
.lp-prevnext {
  padding: 40px var(--lp-gutter);
  border-top: 1px solid var(--tp-rule);
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.lp-prev { padding-right: 24px; border-right: 1px solid var(--tp-rule); }
.lp-next { text-align: right; }

.lp-prev,
.lp-next {
  text-decoration: none;
  color: var(--tp-ink);
  font-family: var(--tp-mono);
}

.lp-prevnext-title {
  display: block;
  margin-top: 12px;
  font-family: var(--tp-serif);
  font-style: italic;
  font-size: clamp(22px, 2.5vw, 32px);
  line-height: 1.1;
}

.lp-prev.is-disabled,
.lp-next.is-disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  .lp { --lp-gutter: 28px; }
  .lp-tabs { grid-template-columns: 1fr; }
  .lp-tab {
    border-right: none;
    border-bottom: 1px solid var(--tp-rule);
  }
  .lp-tab:last-child { border-bottom: none; }
  .lp-body {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .lp-toc { position: static; }
}

@media (max-width: 720px) {
  .lp { --lp-gutter: 20px; }
  .lp-eyebrow-row { flex-direction: column; gap: 8px; }
  .lp-section-head { grid-template-columns: 40px 1fr; gap: 12px; }
  .lp-section-num { font-size: 24px; }
  .lp-prevnext { grid-template-columns: 1fr; gap: 24px; }
  .lp-prev { border-right: none; padding-right: 0; padding-bottom: 24px; border-bottom: 1px solid var(--tp-rule); }
  .lp-next { text-align: left; }
  .lp-tab-title { font-size: 32px; }
}
