/* Falak Labs: privacy, terms, safety, support and data-deletion pages.
   Loaded after style.css. The page header sits on lapis; the document reads on a parchment sheet. */

.legal-page {
  --sheet: #F7F2E7;
  --sheet-tint: #EEE5D2;
  --ink: #1D2550;
  --ink-soft: #4A5280;
  --rule: rgba(10, 20, 64, 0.14);
  --link: #2440B8;
  --bronze: #8A5D14;
}

html:has(.legal-page) { scroll-behavior: smooth; }

.legal-page .site-header { position: absolute; }
.legal-home { font-size: 0.95rem; font-weight: 500; }

/* ---------------------------------------------------------------- page header */

.legal-hero {
  position: relative;
  overflow-x: clip;
  overflow-y: visible;
  padding: calc(var(--header-h) + env(safe-area-inset-top, 0px) + clamp(20px, 4.5vw, 60px)) var(--pad-r) clamp(92px, 11vw, 140px) var(--pad-l);
  background:
    linear-gradient(to bottom, rgba(10, 20, 64, 0) 55%, var(--lapis)),
    radial-gradient(60% 90% at 88% 8%, rgba(36, 64, 184, 0.5), rgba(10, 20, 64, 0) 70%),
    var(--lapis);
}
.legal-hero__inner {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
}
.legal-hero__dial {
  position: absolute;
  z-index: 0;
  top: 50%;
  right: max(-140px, -9vw);
  width: min(50vw, 600px);
  height: auto;
  transform: translateY(-50%);
  opacity: 0.6;
  pointer-events: none;
}
.legal-hero__eyebrow {
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}
.legal-hero__title {
  margin-top: 0.55rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step-3);
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.legal-hero__lead {
  margin-top: 1rem;
  max-width: 36em;
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--mist);
  text-wrap: pretty;
}
.legal-hero__meta {
  margin-top: 0.9rem;
  font-size: var(--step--1);
  color: var(--mist);
}
.legal-hero__meta span { white-space: nowrap; }

.doc-tabs { margin-top: clamp(24px, 3.2vw, 38px); }
.doc-tabs ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.doc-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0.55em 1.1em;
  border: 1px solid rgba(232, 182, 90, 0.34);
  border-radius: 999px;
  color: var(--parchment);
  font-size: 0.94rem;
  font-weight: 500;
  line-height: 1.1;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.3s linear, color 0.3s linear, background-color 0.3s linear;
}
.doc-tabs a:hover { border-color: var(--gold); color: var(--gold-soft); }
.doc-tabs a[aria-current="page"] {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--lapis);
  font-weight: 650;
}

/* ---------------------------------------------------------------- the sheet */

.legal-main { padding: 0 var(--pad-r) clamp(56px, 8vw, 104px) var(--pad-l); }

.sheet {
  position: relative;
  max-width: 1120px;
  margin: calc(-1 * clamp(56px, 7.5vw, 96px)) auto 0;
  padding: clamp(24px, 5vw, 64px) clamp(20px, 5.5vw, 72px) clamp(36px, 5.5vw, 72px);
  border-radius: clamp(16px, 2vw, 24px);
  background: var(--sheet);
  color: var(--ink);
  box-shadow: 0 0 0 1px rgba(232, 182, 90, 0.2), 0 44px 90px -34px rgba(2, 5, 20, 0.75);
}
.sheet :focus-visible { outline-color: var(--link); }
.sheet__grid { display: grid; grid-template-columns: minmax(0, 1fr); }

/* contents */
.toc--desktop { display: none; }
.toc__title,
.toc summary {
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.toc ol {
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--rule);
}
.toc a {
  display: flex;
  gap: 0.55em;
  margin-left: -1px;
  padding: 0.42em 0 0.42em 1em;
  border-left: 2px solid transparent;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.35;
  text-decoration: none;
  transition: color 0.2s linear, border-color 0.2s linear;
}
.toc a:hover { color: var(--lapis); }
.toc a.is-current { border-left-color: var(--bronze); color: var(--lapis); font-weight: 600; }
.toc__num { flex: none; min-width: 1.4em; color: var(--bronze); font-variant-numeric: tabular-nums; }

.toc--mobile {
  margin-bottom: 2rem;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--sheet-tint);
}
.toc--mobile summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 18px;
  cursor: pointer;
  list-style: none;
}
.toc--mobile summary::-webkit-details-marker { display: none; }
.toc--mobile summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.3s var(--ease-out);
}
.toc--mobile details[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.toc--mobile ol { margin: 0 18px 16px; }

@media (min-width: 1000px) {
  .sheet__grid {
    grid-template-columns: 212px minmax(0, 1fr);
    gap: clamp(40px, 5vw, 72px);
  }
  .toc--desktop {
    display: block;
    position: sticky;
    top: 28px;
    align-self: start;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
  }
  .toc--mobile { display: none; }
}

/* ---------------------------------------------------------------- document type */

.doc {
  max-width: 44rem;
  font-size: 1.0625rem;
  line-height: 1.7;
}
.doc__intro { font-size: 1.12rem; line-height: 1.65; }
.doc section { margin-top: clamp(2.4rem, 4vw, 3.2rem); scroll-margin-top: 24px; }
.doc h2 {
  display: flex;
  align-items: baseline;
  gap: 0.5em;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.45rem, 1.2rem + 0.8vw, 1.9rem);
  line-height: 1.2;
  letter-spacing: -0.005em;
  color: var(--lapis);
  text-wrap: balance;
}
.doc h2 .num {
  flex: none;
  min-width: 1.45em;
  font-size: 0.78em;
  color: var(--bronze);
  font-variant-numeric: tabular-nums;
}
.doc h3 {
  margin-top: 1.9rem;
  font-family: var(--font-text);
  font-size: 1.08rem;
  font-weight: 650;
  line-height: 1.35;
  color: var(--lapis);
  scroll-margin-top: 24px;
}
.doc p,
.doc ul,
.doc .table-wrap { margin-top: 0.95rem; }
.doc h3 + p,
.doc h3 + ul { margin-top: 0.5rem; }
.doc ul { padding-left: 1.25em; }
.doc li + li { margin-top: 0.5em; }
.doc li::marker { color: var(--bronze); }
.doc a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(36, 64, 184, 0.45);
  text-underline-offset: 0.18em;
  overflow-wrap: anywhere;
  transition: color 0.2s linear, text-decoration-color 0.2s linear;
}
.doc a:hover { color: var(--lapis); text-decoration-color: currentColor; }
.doc strong { font-weight: 650; color: var(--lapis); }

.summary {
  margin-top: 1.8rem;
  padding: clamp(20px, 3vw, 28px) clamp(20px, 3.2vw, 32px);
  border: 1px solid rgba(138, 93, 20, 0.24);
  border-radius: 16px;
  background: var(--sheet-tint);
}
.doc > .summary:first-child { margin-top: 0; }
.summary h2 { display: block; font-size: 1.25rem; }
.summary ul { margin-top: 0.75rem; }

.contact-card__email {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem);
  font-weight: 600;
  line-height: 1.2;
}
.doc .contact-card__email { margin-top: 0.4rem; }
.doc .contact-card__email a {
  color: var(--lapis);
  text-decoration: none;
  border-bottom: 2px solid var(--gold);
}
.doc .contact-card__email a:hover { border-bottom-color: var(--lapis); }

.doc .callout {
  margin-top: 1.2rem;
  padding: 14px 18px;
  border-left: 3px solid #B3402A;
  border-radius: 0 10px 10px 0;
  background: rgba(179, 64, 42, 0.07);
}

.table-wrap {
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
}
.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.55;
}
.doc th,
.doc td {
  padding: 12px 16px;
  border-top: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}
.doc thead th {
  border-top: 0;
  background: var(--sheet-tint);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.doc tbody td:first-child { font-weight: 600; color: var(--lapis); }

.doc__history {
  margin-top: 3rem !important;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
  font-size: 0.92rem;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------- small screens */

@media (max-width: 760px) {
  .legal-hero__dial { top: 18%; right: -38vw; width: 92vw; opacity: 0.32; }
  .doc-tabs { margin-inline: calc(var(--pad-l) * -1) calc(var(--pad-r) * -1); }
  .doc-tabs ul {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 2px var(--pad-r) 6px var(--pad-l);
    scrollbar-width: none;
    scroll-padding-inline: var(--pad-l);
  }
  .doc-tabs ul::-webkit-scrollbar { display: none; }
  .doc { font-size: 1.03rem; }
  .doc h2 { gap: 0.4em; }
  .doc h2 .num { min-width: 1.15em; }
}

@media (max-width: 640px) {
  .doc table,
  .doc tbody,
  .doc tr,
  .doc td { display: block; }
  .doc thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .doc tr { padding: 12px 16px; border-top: 1px solid var(--rule); }
  .doc tbody tr:first-child { border-top: 0; }
  .doc td { padding: 0; border: 0; }
  .doc td + td { margin-top: 0.45rem; }
  .doc td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-soft);
  }
  .doc tbody td:first-child::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html:has(.legal-page) { scroll-behavior: auto; }
}

/* ---------------------------------------------------------------- print */

@media print {
  html, body, .legal-page { background: #fff !important; color: #000; }
  .site-header, .doc-tabs, .toc, .site-footer, .legal-hero__dial, .skip-link { display: none !important; }
  .legal-hero { padding: 0 0 12pt; background: none; }
  .legal-hero__eyebrow, .legal-hero__title, .legal-hero__lead, .legal-hero__meta { color: #000; }
  .legal-main { padding: 0; }
  .sheet { max-width: none; margin: 0; padding: 0; border-radius: 0; background: none; box-shadow: none; color: #000; }
  .sheet__grid { display: block; }
  .doc { max-width: none; font-size: 10.5pt; line-height: 1.5; }
  .doc h2, .doc h3, .doc strong, .doc tbody td:first-child { color: #000; }
  .doc a { color: #000; text-decoration: none; }
  .doc a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; }
  .summary, .table-wrap, .doc thead th { background: none; border-color: #999; }
  .doc h2, .doc h3 { break-after: avoid; }
  .doc tr, .summary, .callout { break-inside: avoid; }
}
