/* ============================================================================
   SceneLedger privacy policy — page styles
   Loaded 5th in the frozen cascade:
     tokens → base → components → product → THIS → motion
   ----------------------------------------------------------------------------
   This is a LEGAL DOCUMENT sitting inside the product shell, so it inherits
   `body.product-page.theme-sceneledger` (navy-900 ground, --product-accent =
   --accent-sl coral, --product-accent-text = --accent-sl-soft). Consume
   var(--token) only — raw hex lives in tokens.css and nowhere else.

   Design decisions worth knowing:

   1. NO position:sticky anywhere. ScrollSmoother translates #smooth-content on
      every frame, and a sticky element inside a transformed ancestor drifts
      instead of sticking. The table of contents is therefore a card at the top
      of the document, not a sticky rail.

   2. Two measures. Prose runs at --legal-measure (70ch) for readability;
      the two declaration appendices break out to --legal-measure-wide so the
      tables have room. Both are centred, so the break-out reads as deliberate.

   3. base.css resets ALL margins/padding to 0, strips list markers and makes
      links `color: inherit; text-decoration: none`. A document body has to put
      all of that back, which is most of what this file does.

   4. Tables scroll INSIDE their wrapper (.legal-table-wrap, overflow-x:auto);
      the page body must never scroll horizontally.
   ========================================================================== */

.legal-page {
  --legal-measure: 70ch;
  --legal-measure-wide: 54rem;
  /* Anchor clearance for the FIXED 72px header. Covers the no-JS / pre-boot
     path (native #hash jump); main.js's anchor bridge applies its own offset
     when it is running. */
  --legal-anchor-offset: calc(var(--header-h, 72px) + var(--space-5));
}

/* ===========================================================================
   DOCUMENT HEAD BAND
   Mirrors the product hero's depth step: the breadcrumb sits on the navy-900
   page ground, then the head band deepens to the navy-950 void.
   =========================================================================== */
.legal-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: var(--space-7) var(--space-10);
  background-color: var(--navy-950);
}

/* Cool atmosphere pool with a faint coral core glint — the same treatment as
   .product-hero, weighted left because there is no visual on the right. */
.legal-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(58% 70% at 22% 12%,
      rgba(44, 80, 120, 0.26) 0%,
      rgba(44, 80, 120, 0.08) 42%,
      transparent 72%),
    radial-gradient(34% 42% at 16% 6%,
      color-mix(in srgb, var(--product-accent) 12%, transparent) 0%,
      transparent 62%);
}

/* Centred on the SAME column as .legal-toc / .legal-section below, which are
   both `margin-inline: auto` at --legal-measure. Left-aligning this block
   instead puts the h1 ~200px left of the document body on a wide screen — it
   reads as a layout bug, not as a deliberate hang. */
.legal-hero__inner {
  position: relative;
  z-index: 1;
  max-width: var(--legal-measure);
  margin-inline: auto;
}

.legal-hero__kicker {
  /* AA-safe coral on the navy-950 void (see product.css contrast note). */
  color: var(--product-accent-text, var(--product-accent));
  margin-bottom: var(--space-4);
}

.legal-hero__title {
  font-size: var(--fs-h1);
  line-height: var(--lh-tight);
  color: var(--ink);
}

.legal-hero__lead {
  margin-top: var(--space-4);
  font-size: var(--fs-lead);
  line-height: var(--lh-snug);
  color: var(--ink-body);
  max-width: 52ch;
}

/* --- document meta (effective date / scope / publisher / contact) --------- */
.legal-meta {
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line-strong);
  display: grid;
  gap: var(--space-3);
}

.legal-meta__row {
  display: grid;
  gap: var(--space-1);
}

.legal-meta dt {
  font-family: var(--font-mono);
  font-size: var(--fs-kicker);
  font-weight: 500;
  letter-spacing: var(--ls-kicker);
  text-transform: uppercase;
  color: var(--ink-soft);
}

.legal-meta dd {
  font-size: var(--fs-small);
  line-height: var(--lh-snug);
  color: var(--ink-body);
}

.legal-meta a {
  color: var(--product-accent-text, var(--product-accent));
  border-bottom: 1px solid color-mix(in srgb, var(--product-accent) 40%, transparent);
  padding-bottom: 1px;
  transition:
    color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}

.legal-meta a:hover,
.legal-meta a:focus-visible {
  color: var(--ink);
  border-bottom-color: currentColor;
}

@media (min-width: 640px) {
  .legal-meta__row {
    grid-template-columns: 10rem minmax(0, 1fr);
    gap: var(--space-4);
    align-items: baseline;
  }
}

/* ===========================================================================
   DOCUMENT BODY
   =========================================================================== */
.legal-body {
  padding-block: var(--space-9) var(--section-py);
  background-color: var(--navy-900);
}

/* ---------------------------------------------------------------------------
   TABLE OF CONTENTS — a card, not a sticky rail (see note 1 at the top).
--------------------------------------------------------------------------- */
.legal-toc {
  max-width: var(--legal-measure);
  margin-inline: auto;
  margin-bottom: var(--space-10);
  padding: var(--space-6);
  background-color: var(--navy-800);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.legal-toc__heading {
  font-family: var(--font-mono);
  font-size: var(--fs-kicker);
  font-weight: 500;
  letter-spacing: var(--ls-kicker);
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: var(--space-5);
}

.legal-toc__list {
  display: grid;
  gap: var(--space-1);
}

.legal-toc__list a {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  margin-inline: calc(var(--space-3) * -1);
  border-radius: var(--radius-sm);
  color: var(--ink-body);
  font-size: var(--fs-small);
  line-height: var(--lh-snug);
  transition:
    color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out);
}

.legal-toc__list a:hover {
  color: var(--ink);
  background-color: color-mix(in srgb, var(--navy-600) 34%, transparent);
}

.legal-toc__list a:focus-visible {
  outline: 2px solid var(--product-accent-text, var(--product-accent));
  outline-offset: 2px;
}

.legal-toc__num {
  flex: 0 0 auto;
  min-width: 2.25ch;
  font-family: var(--font-mono);
  font-size: var(--fs-kicker);
  letter-spacing: var(--ls-tag);
  color: var(--product-accent-text, var(--product-accent));
}

.legal-toc__label {
  flex: 1 1 auto;
}

@media (min-width: 720px) {
  .legal-toc__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--space-6);
  }
}

/* ---------------------------------------------------------------------------
   SECTIONS
--------------------------------------------------------------------------- */
.legal-doc {
  display: flex;
  flex-direction: column;
  gap: var(--space-10);
}

.legal-section {
  width: 100%;
  max-width: var(--legal-measure);
  margin-inline: auto;
  scroll-margin-top: var(--legal-anchor-offset);
}

/* The declaration appendices break out wider so the tables can breathe. */
.legal-section--wide {
  max-width: var(--legal-measure-wide);
}

.legal-section__title {
  font-size: var(--fs-h2);
  color: var(--heading);
  text-wrap: balance;
}

.legal-section__subtitle {
  margin-top: var(--space-7);
  font-size: var(--fs-lead);
  font-weight: var(--fw-display-bold);
  color: var(--ink);
}

/* ---------------------------------------------------------------------------
   PROSE — base.css zeroes every margin, so rebuild the vertical rhythm here.
--------------------------------------------------------------------------- */
.legal-section p {
  margin-top: var(--space-4);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink-body);
}

/* SPECIFICITY NOTE — everything below is a <p> INSIDE .legal-section, so the
   prose rule above (0,1,1) out-specifies a bare single-class selector (0,1,0)
   and silently repaints it as body copy. Verified in a rendered probe: the mono
   section numbers came back as --ink-body 17px instead of coral 12px. Each
   exception is therefore written as a compound (0,2,0) selector, which beats
   (0,1,1) on class count. Do not "simplify" these back to one class. */

/* Mono section number — the house kicker treatment, retinted to the product
   accent exactly as .feature-row__kicker does on the product pages. The dot
   stays beacon amber site-wide (components.css owns that). */
.legal-section .legal-section__num {
  margin-top: 0;
  margin-bottom: var(--space-4);
  font-size: var(--fs-kicker);
  line-height: 1;
  color: var(--product-accent-text, var(--product-accent));
}

.legal-section .legal-section__intro {
  color: var(--ink-soft);
}

.legal-section strong {
  font-weight: var(--fw-semibold);
  color: var(--ink);
}

/* In-prose links. Specificity (0,2,0) — beats base.css's `a { color: inherit }`
   without needing !important, and is scoped to the document so it can never
   reach the header, breadcrumb or footer. */
.legal-section a,
.legal-callout a {
  color: var(--product-accent-text, var(--product-accent));
  border-bottom: 1px solid color-mix(in srgb, var(--product-accent) 45%, transparent);
  padding-bottom: 1px;
  transition:
    color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}

.legal-section a:hover,
.legal-callout a:hover {
  color: var(--ink);
  border-bottom-color: currentColor;
}

.legal-section a:focus-visible,
.legal-callout a:focus-visible {
  outline: 2px solid var(--product-accent-text, var(--product-accent));
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------------------------------------------------------------------------
   LISTS — markers are stripped globally in base.css, so draw our own.
   Default marker is a calm navy tick; coral is reserved for the summary card.
--------------------------------------------------------------------------- */
.legal-list {
  margin-top: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.legal-list > li {
  position: relative;
  padding-left: var(--space-5);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink-body);
}

.legal-list > li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 8px;
  height: 1px;
  background-color: var(--navy-400);
}

.legal-list--accent > li::before {
  background-color: var(--product-accent);
  box-shadow: 0 0 6px color-mix(in srgb, var(--product-accent) 55%, transparent);
}

/* ---------------------------------------------------------------------------
   SUMMARY CARD — the "at a glance" block at the top of section 01.
--------------------------------------------------------------------------- */
.legal-summary {
  margin-top: var(--space-5);
  padding: var(--space-6);
  background-color: var(--navy-800);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--product-accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.legal-summary .legal-list {
  margin-top: 0;
}

/* ---------------------------------------------------------------------------
   CALLOUT — a lifted band for the caveats that matter most.
--------------------------------------------------------------------------- */
.legal-callout {
  margin-top: var(--space-6);
  padding: var(--space-5) var(--space-6);
  background-color: var(--navy-880);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: var(--radius);
}

.legal-callout__label {
  font-family: var(--font-mono);
  font-size: var(--fs-kicker);
  font-weight: 500;
  letter-spacing: var(--ls-kicker);
  text-transform: uppercase;
  color: var(--ink-soft);
}

.legal-callout p {
  margin-top: var(--space-3);
  font-size: var(--fs-small);
  line-height: var(--lh-body);
  color: var(--ink-body);
}

.legal-callout .legal-callout__label {
  margin-top: 0;
  font-size: var(--fs-kicker);
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------------------
   DEFINITION LISTS — permissions, third parties, retention.
--------------------------------------------------------------------------- */
.legal-deflist {
  margin-top: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.legal-deflist__row {
  display: grid;
  gap: var(--space-2);
  padding-block: var(--space-4);
  border-top: 1px solid var(--line);
}

.legal-deflist__row:last-child {
  border-bottom: 1px solid var(--line);
}

.legal-deflist dt {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  font-weight: 500;
  letter-spacing: var(--ls-tag);
  color: var(--ink);
}

.legal-deflist dd {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink-body);
}

@media (min-width: 720px) {
  .legal-deflist__row {
    grid-template-columns: 13rem minmax(0, 1fr);
    gap: var(--space-5);
  }
}

/* ---------------------------------------------------------------------------
   TABLES — the two declaration appendices. The site has no table styles.
   The wrapper is the scroll container; the page body never scrolls sideways.
--------------------------------------------------------------------------- */
.legal-table-wrap {
  max-width: 100%;
  margin-top: var(--space-6);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background-color: var(--navy-800);
  box-shadow: var(--shadow-sm);

  /* Scroll-shadow affordance (the `background-attachment: local` technique).
     The two `local` layers scroll WITH the content and mask the shadow when
     you reach an edge; the two `scroll` layers are pinned to the frame and
     show a shadow only while there is more table in that direction. Pure CSS,
     and specifically NOT position:sticky — ScrollSmoother transforms
     #smooth-content, and sticky inside a transformed ancestor drifts. */
  background-image:
    linear-gradient(to right, var(--navy-800) 40%, color-mix(in srgb, var(--navy-800) 0%, transparent)),
    linear-gradient(to left,  var(--navy-800) 40%, color-mix(in srgb, var(--navy-800) 0%, transparent)),
    linear-gradient(to right, rgba(3, 8, 14, 0.55), rgba(3, 8, 14, 0)),
    linear-gradient(to left,  rgba(3, 8, 14, 0.55), rgba(3, 8, 14, 0));
  background-position: left center, right center, left center, right center;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 16px 100%, 16px 100%;
  background-attachment: local, local, scroll, scroll;
}

/* Swipe hint — only meaningful where the table actually overflows, so it is
   revealed in the narrow media query at the bottom of this file. Compound
   selector: it is a <p> inside .legal-section, so it has to clear (0,1,1). */
.legal-section .legal-table-hint {
  display: none;
  margin-top: var(--space-6);
  margin-bottom: calc(var(--space-3) * -1);
  font-family: var(--font-mono);
  font-size: var(--fs-kicker);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-tag);
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* The wrapper is keyboard-focusable (tabindex=0) so a scrollable table can be
   reached without a pointer — give that focus a visible ring. */
.legal-table-wrap:focus-visible {
  outline: 2px solid var(--product-accent-text, var(--product-accent));
  outline-offset: 2px;
}

.legal-table {
  width: 100%;
  /* Forces the horizontal scroll on narrow viewports rather than crushing the
     columns into unreadable slivers. */
  min-width: 34rem;
  border-collapse: collapse;
  font-size: var(--fs-small);
  line-height: var(--lh-snug);
}

.legal-table__caption {
  caption-side: top;
  text-align: left;
  padding: var(--space-4) var(--space-5) var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--fs-kicker);
  font-weight: 500;
  letter-spacing: var(--ls-kicker);
  text-transform: uppercase;
  color: var(--ink-soft);
}

.legal-table thead th {
  text-align: left;
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--fs-kicker);
  font-weight: 500;
  letter-spacing: var(--ls-tag);
  text-transform: uppercase;
  color: var(--ink-soft);
  background-color: color-mix(in srgb, var(--navy-700) 45%, transparent);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}

.legal-table tbody th,
.legal-table tbody td {
  padding: var(--space-4) var(--space-5);
  vertical-align: top;
  border-top: 1px solid var(--line);
}

.legal-table tbody th {
  text-align: left;
  font-family: var(--font-body);
  font-weight: var(--fw-semibold);
  color: var(--ink);
  min-width: 12rem;
}

.legal-table tbody td {
  color: var(--ink-body);
}

.legal-table tbody tr:first-child th,
.legal-table tbody tr:first-child td {
  border-top: 0;
}

/* Lists inside a cell (Apple's category groupings). */
.legal-cell-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.legal-cell-list > li {
  position: relative;
  padding-left: var(--space-4);
}

.legal-cell-list > li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 1px;
  background-color: var(--navy-400);
}

/* --- collected / not-collected pill --------------------------------------
   Coral marks a "collected" row so the eye lands on the rows that matter.
   Both variants verified AA (>=4.5:1) against the navy-800 table ground:
     yes  #FF7A5C on the 10% coral wash  → ~4.8:1
     no   #8FA8C2 on the navy-700 wash   → ~6.1:1
--------------------------------------------------------------------------- */
.legal-flag {
  display: inline-block;
  padding: 0.25em 0.7em;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: var(--ls-tag);
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid;
  border-radius: var(--radius-pill);
}

.legal-flag--yes {
  color: var(--product-accent-text, var(--product-accent));
  border-color: color-mix(in srgb, var(--product-accent) 42%, transparent);
  background-color: color-mix(in srgb, var(--product-accent) 10%, transparent);
}

.legal-flag--no {
  color: var(--ink-soft);
  border-color: var(--line-strong);
  background-color: color-mix(in srgb, var(--navy-700) 30%, transparent);
}

/* ---------------------------------------------------------------------------
   CONTACT BLOCK + END NOTE
--------------------------------------------------------------------------- */
/* Compound selectors again — .legal-contact and .legal-endnote are <p> inside
   .legal-section, so they must clear (0,1,1). See the specificity note above. */
.legal-section .legal-contact {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-top: var(--space-5);
  padding: var(--space-5) var(--space-6);
  background-color: var(--navy-800);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.legal-contact__name {
  font-weight: var(--fw-semibold);
  color: var(--ink);
}

.legal-contact__place {
  font-size: var(--fs-small);
  color: var(--ink-soft);
}

.legal-contact__email {
  margin-top: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  align-self: flex-start;
}

.legal-section .legal-endnote {
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: var(--fs-kicker);
  letter-spacing: var(--ls-tag);
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ===========================================================================
   NARROW VIEWPORTS
   =========================================================================== */
@media (max-width: 559.98px) {
  .legal-toc,
  .legal-summary {
    padding: var(--space-5);
  }

  .legal-callout,
  .legal-contact {
    padding: var(--space-5) var(--space-4);
  }

  /* Below this width the declaration tables genuinely overflow their wrapper,
     so say so — the scroll shadow alone is not an instruction. */
  .legal-section .legal-table-hint {
    display: block;
  }

  /* Tighter gutters and a narrower row-header column so more of the purpose
     column is visible before the reader has to swipe. */
  .legal-table thead th,
  .legal-table tbody th,
  .legal-table tbody td {
    padding-inline: var(--space-4);
  }

  .legal-table tbody th {
    min-width: 9.5rem;
  }
}

/* ===========================================================================
   PRINT — people print privacy policies, and store reviewers save them as PDF.
   ScrollSmoother leaves a transform on #smooth-content that clips print
   output, so neutralise the wrapper and drop everything decorative.
   =========================================================================== */
@media print {
  #smooth-wrapper,
  #smooth-content {
    transform: none !important;
    position: static !important;
    width: auto !important;
    height: auto !important;
  }

  .site-header,
  .mobile-menu,
  .scroll-progress,
  .cursor-ring,
  .grain-overlay,
  .skip-link,
  .page-wipe,
  .site-footer,
  .legal-toc {
    display: none !important;
  }

  .legal-page {
    background: #fff !important;
    color: #000 !important;
  }

  .legal-hero,
  .legal-body {
    background: #fff !important;
    padding-block: 0 !important;
  }

  .legal-hero::before {
    display: none !important;
  }

  .legal-hero__title,
  .legal-hero__lead,
  .legal-section__title,
  .legal-section__subtitle,
  .legal-section p,
  .legal-list > li,
  .legal-deflist dt,
  .legal-deflist dd,
  .legal-table,
  .legal-table tbody th,
  .legal-table tbody td,
  .legal-meta dt,
  .legal-meta dd {
    color: #000 !important;
  }

  .legal-section,
  .legal-section--wide {
    max-width: none;
    break-inside: avoid-page;
  }

  .legal-table-wrap {
    overflow: visible !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  .legal-table {
    min-width: 0;
  }

  .legal-summary,
  .legal-callout,
  .legal-contact,
  .legal-table-wrap {
    border-color: #999 !important;
    background: transparent !important;
  }

  .legal-section a,
  .legal-meta a {
    color: #000 !important;
    border-bottom-color: #999 !important;
  }
}

/* ===========================================================================
   REDUCED MOTION — drop the decorative coral glow on summary markers.
   =========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .legal-list--accent > li::before {
    box-shadow: none;
  }
}
