/* ==========================================================================
   legal.css: Terms & Conditions and Privacy Policy pages
   (home/templates/landing/legal/). Builds on landing.css: every colour, radius,
   font and easing comes from its :root tokens, and buttons reuse .btn.
   ========================================================================== */

/* ---------------- Hero ---------------- */
.legal .lhero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: var(--bone);
  background: radial-gradient(110% 120% at 92% -20%, rgba(61, 181, 74, 0.24) 0%, transparent 55%), linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  padding: clamp(48px, 7vw, 96px) 0 clamp(52px, 7vw, 88px);
  border-bottom: 1px solid var(--forest-3);
}
/* survey-sheet grid, fading out to the left */
.legal .lhero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(rgba(246, 242, 233, 0.07) 1px, transparent 1px), linear-gradient(90deg, rgba(246, 242, 233, 0.07) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: linear-gradient(100deg, transparent 20%, #000 85%);
          mask-image: linear-gradient(100deg, transparent 20%, #000 85%);
}
.legal .lhero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--lime);
}
.legal .lhero__eyebrow::before {
  content: "";
  width: 26px;
  height: 2px;
  background: var(--lime);
}
.legal .lhero__title {
  font-family: "Google Sans", system-ui, sans-serif;
  font-optical-sizing: auto;
  font-weight: 500;
  font-size: clamp(2.3rem, 5vw, 3.8rem);
  line-height: 1;
  letter-spacing: -0.015em;
  margin-top: 18px;
  max-width: 18ch;
}
.legal .lhero__title em {
  font-style: italic;
  color: var(--lime);
}
.legal .lhero__sub {
  margin-top: 18px;
  max-width: 62ch;
  color: var(--on-dark-soft);
  font-size: 1.06rem;
}
.legal .lhero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
  padding: 0;
  list-style: none;
}
.legal .lchip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--line-light);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--on-dark);
  background: rgba(255, 255, 255, 0.04);
}
.legal .lchip svg {
  width: 15px;
  height: 15px;
  color: var(--lime);
}
.legal .lchip--draft {
  border-color: rgba(255, 185, 80, 0.45);
  background: rgba(255, 185, 80, 0.1);
  color: #ffd79a;
}
.legal .lchip--draft svg {
  color: #ffb950;
}
.legal .lhero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

/* ---------------- Layout ---------------- */
.legal .legal__body {
  padding: clamp(36px, 6vw, 72px) 0 clamp(64px, 8vw, 110px);
}
.legal .legal__layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}
@media (max-width: 960px) {
  .legal .legal__layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
}

/* ---------------- Table of contents ---------------- */
.legal .ltoc {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  max-height: calc(100vh - var(--header-h) - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 12px 16px;
  box-shadow: 0 18px 40px -32px rgba(12, 26, 43, 0.45);
}
.legal .ltoc__title {
  display: block;
  padding: 0 10px 12px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.legal .ltoc__toggle {
  display: none;
}
.legal .ltoc__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 2px;
}
.legal .ltoc__list a {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--ink-soft);
  transition: background 0.25s, color 0.25s;
}
.legal .ltoc__list a:hover {
  background: rgba(61, 181, 74, 0.08);
  color: var(--ink);
}
.legal .ltoc__list a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}
.legal .ltoc__list a.is-active {
  background: rgba(61, 181, 74, 0.13);
  color: var(--forest);
  font-weight: 600;
}
.legal .ltoc__n {
  flex: 0 0 1.7em;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-mute);
}
.legal .ltoc__list a.is-active .ltoc__n {
  color: var(--brand-d);
}
.legal .ltoc__other {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 10px 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--brand-d);
}
.legal .ltoc__other svg {
  width: 16px;
  height: 16px;
}
.legal .ltoc__other:hover {
  color: var(--forest);
}

/* Mobile / tablet: the contents collapse into an "On this page" bar under the header. */
@media (max-width: 960px) {
  .legal .ltoc {
    top: var(--header-h);
    z-index: 20;
    max-height: none;
    overflow: visible;
    padding: 0;
    border-radius: var(--radius-sm);
  }
  .legal .ltoc__title {
    display: none;
  }
  .legal .ltoc__toggle {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: 0;
    background: none;
    color: var(--ink);
    font-weight: 600;
    font-size: 0.95rem;
    text-align: left;
  }
  .legal .ltoc__toggle svg {
    width: 18px;
    height: 18px;
    color: var(--brand-d);
  }
  .legal .ltoc__current {
    margin-left: auto;
    max-width: 50%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--ink-mute);
  }
  .legal .ltoc__chev {
    transition: transform 0.3s var(--ease);
  }
  .legal .ltoc.is-open .ltoc__chev {
    transform: rotate(180deg);
  }
  .legal .ltoc__panel {
    max-height: 60vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px 8px 12px;
    border-top: 1px solid var(--line);
  }
  /* Collapsed only when JS is running; without JS the list stays visible. */
  .js .legal .ltoc:not(.is-open) .ltoc__panel {
    display: none;
  }
}

/* ---------------- Document ---------------- */
.legal .ldoc {
  max-width: 780px;
  min-width: 0;
}
.legal .ldoc section {
  scroll-margin-top: calc(var(--header-h) + 24px);
  margin-bottom: clamp(40px, 5vw, 56px);
}
@media (max-width: 960px) {
  .legal .ldoc section {
    /* header + the sticky "On this page" bar */
    scroll-margin-top: calc(var(--header-h) + 76px);
  }
}
.legal .ldoc h2 {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-family: "Google Sans", system-ui, sans-serif;
  font-optical-sizing: auto;
  font-weight: 500;
  font-size: clamp(1.45rem, 2.4vw, 1.9rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.legal .ldoc h2 .ldoc__n {
  flex: 0 0 auto;
  font-family: "Stack Sans Text", system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
  color: var(--brand-d);
  background: rgba(61, 181, 74, 0.12);
  border-radius: 999px;
  padding: 4px 10px;
  transform: translateY(-3px);
}
.legal .ldoc h3 {
  font-family: "Google Sans", system-ui, sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  line-height: 1.3;
  color: var(--ink);
  margin: 28px 0 8px;
}
.legal .ldoc p,
.legal .ldoc li,
.legal .ldoc dd {
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.72;
}
.legal .ldoc p + p {
  margin-top: 14px;
}
.legal .ldoc strong {
  color: var(--ink);
  font-weight: 600;
}
.legal .ldoc a {
  color: var(--brand-d);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}
.legal .ldoc a:hover {
  color: var(--forest);
}
.legal .ldoc ul,
.legal .ldoc ol {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: grid;
  gap: 9px;
}
.legal .ldoc ul + p,
.legal .ldoc ol + p,
.legal .ldoc .lnote + p,
.legal .ldoc .ltable-wrap + p {
  margin-top: 16px;
}
.legal .ldoc ul > li {
  position: relative;
  padding-left: 24px;
}
/* survey-peg bullet */
.legal .ldoc ul > li::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 0.68em;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--brand);
  transform: rotate(45deg);
}
.legal .ldoc ol {
  counter-reset: clause;
}
.legal .ldoc ol > li {
  position: relative;
  padding-left: 34px;
  counter-increment: clause;
}
.legal .ldoc ol > li::before {
  content: "(" counter(clause, lower-alpha) ")";
  position: absolute;
  left: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--brand-d);
}

/* Key points summary */
.legal .lsummary {
  margin-bottom: clamp(40px, 5vw, 56px);
  padding: clamp(22px, 3vw, 30px);
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px -34px rgba(12, 26, 43, 0.5);
}
.legal .lsummary__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Google Sans", system-ui, sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--ink);
}
.legal .lsummary__title svg {
  width: 20px;
  height: 20px;
  color: var(--brand-d);
}
.legal .lsummary__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}
@media (max-width: 640px) {
  .legal .lsummary__grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
.legal .lsummary__item {
  display: flex;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--bone);
  border: 1px solid var(--line-2);
}
.legal .lsummary__item svg {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  color: var(--brand-d);
}
.legal .ldoc .lsummary__item p {
  font-size: 0.93rem;
  line-height: 1.55;
}

/* Callouts */
.legal .lnote {
  display: flex;
  gap: 14px;
  margin-top: 18px;
  padding: 18px 20px;
  border-radius: var(--radius-sm);
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
}
.legal .lnote > svg {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 3px;
  color: var(--brand-d);
}
.legal .lnote__body {
  min-width: 0;
}
.legal .ldoc .lnote p {
  font-size: 0.97rem;
}
.legal .lnote--key {
  background: var(--forest);
  border-color: var(--forest-3);
  border-left-color: var(--lime);
}
.legal .lnote--key > svg {
  color: var(--lime);
}
.legal .ldoc .lnote--key p,
.legal .ldoc .lnote--key li {
  color: var(--on-dark-soft);
}
.legal .ldoc .lnote--key strong {
  color: var(--bone);
}
.legal .ldoc .lnote--key ul > li::before {
  background: var(--lime);
}
.legal .lnote--draft {
  margin: 0 0 clamp(28px, 4vw, 40px);
  background: #fff7e8;
  border-color: #f3dcb0;
  border-left-color: #e8a33d;
}
.legal .lnote--draft > svg {
  color: #b9741a;
}
.legal .ldoc .lnote--draft p {
  color: #6b4a16;
}
.legal .ldoc .lnote--draft strong {
  color: #4f350c;
}

/* Definitions */
.legal .ldefs {
  margin: 16px 0 0;
  display: grid;
  grid-template-columns: minmax(140px, 190px) minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  overflow: hidden;
}
.legal .ldefs dt,
.legal .ldefs dd {
  margin: 0;
  padding: 14px 18px;
  border-top: 1px solid var(--line-2);
}
.legal .ldefs dt:first-of-type,
.legal .ldefs dt:first-of-type + dd {
  border-top: 0;
}
.legal .ldefs dt {
  font-family: "Google Sans", system-ui, sans-serif;
  font-weight: 600;
  color: var(--ink);
  background: rgba(61, 181, 74, 0.05);
}
.legal .ldoc .ldefs dd {
  font-size: 0.96rem;
}
@media (max-width: 640px) {
  .legal .ldefs {
    grid-template-columns: minmax(0, 1fr);
  }
  .legal .ldefs dt {
    padding-bottom: 4px;
  }
  .legal .ldefs dd {
    border-top: 0;
    padding-top: 4px;
  }
}

/* Tables (wrapped so they scroll sideways on narrow screens, not the page) */
.legal .ltable-wrap {
  margin-top: 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
}
.legal .ltable {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 0.93rem;
}
.legal .ltable th,
.legal .ltable td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
  border-top: 1px solid var(--line-2);
  line-height: 1.55;
}
.legal .ltable thead th {
  border-top: 0;
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-mute);
  background: rgba(61, 181, 74, 0.06);
}
.legal .ltable td {
  color: var(--ink-soft);
}
.legal .ltable td:first-child {
  font-weight: 600;
  color: var(--ink);
  width: 30%;
}

/* Contact card */
.legal .lcontact {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}
@media (max-width: 640px) {
  .legal .lcontact {
    grid-template-columns: minmax(0, 1fr);
  }
}
.legal .ldoc .lcontact > li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--paper);
  border: 1px solid var(--line);
}
.legal .ldoc .lcontact > li::before {
  display: none;
}
.legal .lcontact svg {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 3px;
  color: var(--brand-d);
}
.legal .lcontact__label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.legal .ldoc .lcontact a {
  text-decoration: none;
  color: var(--ink);
}
.legal .ldoc .lcontact a:hover {
  color: var(--brand-d);
}

/* Closing line of the document */
.legal .ldoc__end {
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
  color: var(--ink-mute);
}

/* ---------------- Print: just the document ---------------- */
@media print {
  .pageloader,
  .topbar,
  .site-header,
  .closing,
  .scrolltop,
  .chat,
  .legal .ltoc,
  .legal .lhero__actions {
    display: none !important;
  }
  body::before {
    display: none;
  }
  body {
    background: #fff;
    font-size: 11pt;
  }
  .legal .lhero {
    background: none;
    color: var(--ink);
    padding: 0 0 16px;
    border-bottom: 1px solid #999;
  }
  .legal .lhero::before {
    display: none;
  }
  .legal .lhero__eyebrow,
  .legal .lhero__title em,
  .legal .lhero__sub,
  .legal .lchip {
    color: var(--ink);
  }
  .legal .legal__layout {
    display: block;
  }
  .legal .ldoc {
    max-width: none;
  }
  .legal .ldoc section {
    break-inside: auto;
  }
  .legal .ldoc h2 {
    break-after: avoid;
  }
  .legal .lnote--key {
    background: #fff;
    border: 1px solid #999;
  }
  .legal .ldoc .lnote--key p,
  .legal .ldoc .lnote--key li,
  .legal .ldoc .lnote--key strong {
    color: var(--ink);
  }
}
