/* ==========================================================================
   legal.css — shared shell for the three legal Pages
   Loaded only on legal-page.php (see tbi_ai_assets() in functions.php):
     /privacy-policy/   /terms/   /cookie-policy/

   THE BUG THIS FIXES. css/base.css sets `background-color: #0d0714` on body
   but never sets a `color`. Every other page gets away with that because each
   page-specific stylesheet colours its own components. These three Pages had
   no template and therefore no stylesheet at all, so their body copy fell back
   to the UA default — black text on a near-black page. Measured before:
   `getComputedStyle(p).color === "rgb(0, 0, 0)"`.

   The global default is deliberately NOT changed here. Setting a colour on
   body in base.css would reach every page on the site and silently repaint
   components that currently rely on inheriting black over their own light
   backgrounds (.abt-who__heading and .abt-team__heading are two that do).
   The fix is scoped instead.

   SCOPING. Every selector is under body.page-template-legal-page. content.css
   loads site-wide and defines unscoped .container / .hero rules, so an
   unscoped selector here would leak both ways.

   TYPE SCALE is borrowed from the design system already in use rather than
   invented: Gelasio 400 with negative tracking for display headings (as in
   .abt-creds__heading / .abt-work__heading), Inter 600 / 12px / 2.86px
   uppercase for the eyebrow (as in .abt-hero__eyebrow), Inter for body copy.
   Body copy is set slightly larger than the marketing pages' 15px/28px —
   these are long documents that get read, not scanned.
   ========================================================================== */

body.page-template-legal-page {
  color: #b6b1c2;
}

body.page-template-legal-page .lgl-container {
  width: 100%;
  max-width: var(--container-max-width);
  margin-inline: auto;
  padding-inline: var(--container-padding-inline);
}

/* Anchor targets from the table of contents must clear the sticky 77px
   header, which would otherwise cover the heading being jumped to. */
body.page-template-legal-page [id] {
  scroll-margin-top: calc(var(--header-height) + 24px);
}

body.page-template-legal-page a:focus-visible,
body.page-template-legal-page button:focus-visible {
  outline: 2px solid var(--color-cta-bg);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ==========================================================================
   1. HERO
   ========================================================================== */
body.page-template-legal-page .lgl-hero {
  position: relative;
  padding-block: 72px 64px;
  background:
    radial-gradient(80% 120% at 12% 0%, rgba(161, 0, 255, 0.18) 0%, rgba(161, 0, 255, 0) 60%),
    #0d0714;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

body.page-template-legal-page .lgl-hero__inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  max-width: 900px;
}

/* --- breadcrumb --- */
body.page-template-legal-page .lgl-crumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  line-height: 20px;
  color: #8a8496;
}

body.page-template-legal-page .lgl-crumbs li + li::before {
  content: "/";
  margin-right: 8px;
  color: #4d4658;
}

body.page-template-legal-page .lgl-crumbs a {
  color: #8a8496;
  transition: color 0.18s ease;
}

body.page-template-legal-page .lgl-crumbs a:hover {
  color: #fff;
}

body.page-template-legal-page .lgl-crumbs [aria-current="page"] {
  color: #cab5ff;
}

/* --- eyebrow / title / lede --- */
body.page-template-legal-page .lgl-hero__eyebrow {
  margin: 0;
  font-family: var(--font-base);
  font-weight: 600;
  font-size: 12px;
  line-height: normal;
  letter-spacing: 2.86px;
  text-transform: uppercase;
  color: #cab5ff;
}

body.page-template-legal-page .lgl-hero__title {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(38px, 5vw, 64px);
  line-height: 1.06;
  letter-spacing: -2px;
  color: #fff;
}

body.page-template-legal-page .lgl-hero__lede {
  margin: 0;
  max-width: 680px;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(18px, 1.5vw, 22px);
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.82);
}

body.page-template-legal-page .lgl-hero__meta {
  margin: 6px 0 0;
  padding: 7px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  font-size: 13px;
  line-height: 18px;
  letter-spacing: 0.2px;
  color: #8a8496;
}

body.page-template-legal-page .lgl-hero__meta time {
  color: #d8d4e0;
}

/* ==========================================================================
   2. BODY — sticky TOC rail + policy text
   ========================================================================== */
body.page-template-legal-page .lgl-body {
  padding-block: 64px 96px;
  background: #0d0714;
}

body.page-template-legal-page .lgl-body__grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 80px;
  align-items: start;
}

/* The text column is capped well below the grid track so long policy lines
   stay in a readable measure. Before the fix these ran the full 1480px. */
body.page-template-legal-page .lgl-content {
  max-width: 760px;
}

/* --- table of contents --- */
body.page-template-legal-page .lgl-toc {
  position: sticky;
  top: calc(var(--header-height) + 32px);
}

body.page-template-legal-page .lgl-toc__title {
  margin: 0 0 14px;
  font-family: var(--font-base);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: #6f6880;
}

body.page-template-legal-page .lgl-toc__list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: lgl-toc;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

body.page-template-legal-page .lgl-toc__list li {
  counter-increment: lgl-toc;
}

body.page-template-legal-page .lgl-toc__list a {
  display: block;
  padding: 9px 0 9px 18px;
  margin-left: -1px;
  border-left: 1px solid transparent;
  font-size: 14px;
  line-height: 21px;
  color: #948ea3;
  transition: color 0.18s ease, border-color 0.18s ease;
}

body.page-template-legal-page .lgl-toc__list a::before {
  content: counter(lgl-toc) ".";
  margin-right: 8px;
  color: #5d5670;
  font-variant-numeric: tabular-nums;
}

body.page-template-legal-page .lgl-toc__list a:hover {
  color: #fff;
  border-left-color: var(--color-accent-purple);
}

/* ==========================================================================
   3. POLICY TEXT — styling the editor's block output
   The three Pages were imported with every section wrapped in a pointless
   single-column wp:columns > wp:column pair. Rather than rewrite that in the
   database (which an editor re-saving in Gutenberg would undo), the wrappers
   are flattened here so they contribute no layout of their own.
   ========================================================================== */
body.page-template-legal-page .lgl-content .wp-block-columns,
body.page-template-legal-page .lgl-content .wp-block-column {
  display: block;
  width: auto;
  max-width: none;
  flex-basis: auto;
  margin: 0;
  padding: 0;
  gap: 0;
}

/* The import also left decorative <div class="line"> markers that no
   stylesheet in the theme has ever defined. They render as nothing; the rule
   below makes that explicit instead of leaving a mystery empty box. */
body.page-template-legal-page .lgl-content .line {
  display: none;
}

body.page-template-legal-page .lgl-content > :first-child,
body.page-template-legal-page .lgl-content .wp-block-column > :first-child {
  margin-top: 0;
}

body.page-template-legal-page .lgl-content h2 {
  margin: 56px 0 18px;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(26px, 2.4vw, 32px);
  line-height: 1.22;
  letter-spacing: -0.8px;
  color: #fff;
}

body.page-template-legal-page .lgl-content h3 {
  margin: 36px 0 14px;
  font-family: var(--font-base);
  font-weight: 600;
  font-size: 18px;
  line-height: 1.4;
  color: #ece9f2;
}

body.page-template-legal-page .lgl-content p {
  margin: 0 0 20px;
  font-family: var(--font-base);
  font-weight: 400;
  font-size: 17px;
  line-height: 32px;
  color: #b6b1c2;
}

/* Gutenberg emits an empty <p></p> at the end of two of these documents. */
body.page-template-legal-page .lgl-content p:empty {
  display: none;
}

body.page-template-legal-page .lgl-content strong {
  font-weight: 600;
  color: #ece9f2;
}

body.page-template-legal-page .lgl-content ul,
body.page-template-legal-page .lgl-content ol {
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}

body.page-template-legal-page .lgl-content li {
  position: relative;
  padding-left: 26px;
  margin-bottom: 12px;
  font-family: var(--font-base);
  font-size: 17px;
  line-height: 30px;
  color: #b6b1c2;
}

body.page-template-legal-page .lgl-content ul > li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 13px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent-purple);
}

body.page-template-legal-page .lgl-content ol {
  counter-reset: lgl-ol;
}

body.page-template-legal-page .lgl-content ol > li {
  counter-increment: lgl-ol;
}

body.page-template-legal-page .lgl-content ol > li::before {
  content: counter(lgl-ol) ".";
  position: absolute;
  left: 0;
  top: 0;
  color: #7d7690;
  font-variant-numeric: tabular-nums;
}

body.page-template-legal-page .lgl-content a {
  color: #cab5ff;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(202, 181, 255, 0.4);
  overflow-wrap: anywhere;
  transition: color 0.18s ease, text-decoration-color 0.18s ease;
}

body.page-template-legal-page .lgl-content a:hover {
  color: #fff;
  text-decoration-color: #fff;
}

body.page-template-legal-page .lgl-content table {
  width: 100%;
  margin: 0 0 24px;
  border-collapse: collapse;
  font-size: 15px;
}

body.page-template-legal-page .lgl-content th,
body.page-template-legal-page .lgl-content td {
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
  vertical-align: top;
}

body.page-template-legal-page .lgl-content th {
  font-weight: 600;
  color: #ece9f2;
  background: rgba(255, 255, 255, 0.03);
}

/* The last section of every one of these documents is "Contact Us" / an
   address block. Giving the final block a card treatment stops the page
   trailing off into the footer, which is what it did before. */
body.page-template-legal-page .lgl-content .contact-us {
  margin-top: 56px;
  padding: 32px 34px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: #100c19;
}

body.page-template-legal-page .lgl-content .contact-us h2 {
  margin-top: 0;
  font-size: 26px;
}

body.page-template-legal-page .lgl-content .contact-us ul {
  margin-bottom: 0;
}

body.page-template-legal-page .lgl-content .contact-us li:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   4. RELATED POLICIES
   ========================================================================== */
body.page-template-legal-page .lgl-related {
  padding-block: 56px 72px;
  background: #100c19;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

body.page-template-legal-page .lgl-related__title {
  margin: 0 0 22px;
  font-family: var(--font-base);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: #6f6880;
}

body.page-template-legal-page .lgl-related__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 380px));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

body.page-template-legal-page .lgl-related__card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 100%;
  padding: 22px 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: #0d0714;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

body.page-template-legal-page .lgl-related__card:hover {
  border-color: rgba(202, 181, 255, 0.5);
  transform: translateY(-2px);
}

body.page-template-legal-page .lgl-related__card-title {
  font-family: var(--font-base);
  font-weight: 500;
  font-size: 17px;
  line-height: 1.35;
  color: #fff;
}

body.page-template-legal-page .lgl-related__card-arrow {
  flex: none;
  font-size: 18px;
  color: #cab5ff;
  transition: transform 0.18s ease;
}

body.page-template-legal-page .lgl-related__card:hover .lgl-related__card-arrow {
  transform: translateX(4px);
}

/* ==========================================================================
   5. RESPONSIVE
   No Figma frame exists for these pages at any width, so every breakpoint
   below is this build's own interpretation and is not design-verified.
   ========================================================================== */
@media (max-width: 1180px) {
  body.page-template-legal-page .lgl-body__grid {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 48px;
  }
}

@media (max-width: 900px) {
  body.page-template-legal-page .lgl-hero {
    padding-block: 48px 44px;
  }

  body.page-template-legal-page .lgl-body {
    padding-block: 40px 64px;
  }

  /* A sticky rail inside a narrow column would occupy most of the viewport,
     so below this width the TOC becomes a normal card above the text. */
  body.page-template-legal-page .lgl-body__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  body.page-template-legal-page .lgl-toc {
    position: static;
    padding: 20px 22px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    background: #100c19;
  }

  body.page-template-legal-page .lgl-toc__list {
    border-left: 0;
  }

  body.page-template-legal-page .lgl-toc__list a {
    padding: 7px 0;
    margin-left: 0;
    border-left: 0;
  }

  body.page-template-legal-page .lgl-content {
    max-width: none;
  }
}

@media (max-width: 560px) {
  body.page-template-legal-page .lgl-content p,
  body.page-template-legal-page .lgl-content li {
    font-size: 16px;
    line-height: 29px;
  }

  body.page-template-legal-page .lgl-content h2 {
    margin-top: 42px;
  }

  body.page-template-legal-page .lgl-content .contact-us {
    padding: 24px 20px;
  }

  body.page-template-legal-page .lgl-related__list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  body.page-template-legal-page * {
    transition: none !important;
  }

  body.page-template-legal-page .lgl-related__card:hover {
    transform: none;
  }
}
