/* Legal pages: Privacy Policy, Terms of Service, Refund Policy and Disclaimer (owner: pages, with assets/js/legal.js).
   A compact document header on the Document vignette (ink-deep), then the text on cream in a
   3 / 7 / 2 reading split: a sticky table of contents with a sliding active pill and a red rail
   that fills as you read. Wording lives in tools/pages and is never changed here. */

.legal-page { background: var(--cream); }

/* ---------- Hero: Document vignette ---------- */
.legal-hero {
  position: relative; overflow: hidden; display: flex; align-items: center; min-height: 440px;
  padding: var(--hero-top) var(--gutter) 72px;
  background: radial-gradient(60% 70% at 0% 100%, rgba(138, 31, 23, .30), transparent), var(--ink-deep);
  color: var(--cream);
}
.legal-hero__grid {
  position: relative; z-index: 1; width: 100%; display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: var(--gap); align-items: center;
}
.legal-hero__copy { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.legal-hero__copy .eyebrow { margin-bottom: 22px; }
.legal-title { font-size: clamp(44px, 5.6vw, 84px); font-weight: 500; line-height: 1; letter-spacing: -.048em; color: var(--cream); }
.legal-title .serif { letter-spacing: -.02em; }
.legal-lede { max-width: 34em; margin-top: 24px; font-size: clamp(17px, 1.45vw, 20px); line-height: 1.6; color: var(--muted-light); }
.legal-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.legal-meta span {
  display: inline-flex; align-items: center; padding: 7px 12px; border-radius: var(--r-pill); border: 1px solid var(--line-d2);
  font: 500 11px/1.2 'Geist Mono', ui-monospace, monospace; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-light);
}
.legal-hero hr.legal-hero__rule { width: 100%; max-width: 600px; margin-top: 30px; color: var(--cream); }
.js .legal-lede { animation: fadeUp 1s var(--ease) .5s both; }
.js .legal-meta { animation: fadeUp .9s var(--ease) .65s both; }

/* Two paper sheets (desktop only): the front one tilted -4deg with a red seal, the back one at 2deg.
   Layers: .lsheets parallaxes on scroll (legal.js), .lsheets__float floats, each .lsheet enters. */
.lsheets { position: relative; justify-self: center; width: 330px; height: 340px; margin-right: 4%; }
.lsheets__float {
  position: absolute; inset: 0; filter: drop-shadow(0 30px 40px rgba(0, 0, 0, .5)) drop-shadow(0 10px 50px rgba(215, 55, 43, .14));
  animation: lFloat 6s cubic-bezier(.37, 0, .63, 1) infinite; will-change: transform;
}
@keyframes lFloat { 0%, 100% { transform: translateY(-6px); } 50% { transform: translateY(6px); } }
.lsheet {
  position: absolute; width: 220px; height: 280px; padding: 30px 26px; border-radius: var(--r-sm);
  background: linear-gradient(165deg, #fbf7f1, #f3ede4 55%, #ebe3d8);
  clip-path: polygon(0 0, calc(100% - 38px) 0, 100% 38px, 100% 100%, 0 100%);
  transform: rotate(var(--rot));
}
.lsheet::before {
  content: ''; position: absolute; top: 0; right: 0; width: 38px; height: 38px; border-bottom-left-radius: 8px;
  background: linear-gradient(225deg, transparent 50%, #e3d9cb 50%, #efe7dc 100%);
}
.lsheet--back { left: 104px; top: 0; --rot: 2deg; background: linear-gradient(165deg, #ebe4d9, #ddd4c6); }
.lsheet--back::before { background: linear-gradient(225deg, transparent 50%, #d9cebe 50%, #e6ddd0 100%); }
.lsheet--front { left: 6px; top: 48px; --rot: -4deg; }
.lsheet i { display: block; height: 6px; margin-top: 11px; border-radius: 3px; background: rgba(20, 17, 16, .11); }
.lsheet i.m { width: 78%; }
.lsheet i.s { width: 52%; }
.lsheet i.lsheet__h { width: 46%; height: 8px; margin: 0 0 20px; background: rgba(184, 41, 31, .5); }
.lsheet--back i { background: rgba(20, 17, 16, .08); }
.lsheet__seal {
  position: absolute; right: 22px; bottom: 24px; width: 50px; height: 50px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, var(--red-bright), var(--red) 55%, var(--red-deep));
  box-shadow: 0 0 0 4px rgba(215, 55, 43, .12), 0 8px 16px -6px rgba(138, 31, 23, .6), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.lsheet__seal::before { content: ''; position: absolute; inset: 6px; border-radius: 50%; border: 1px dashed rgba(255, 255, 255, .55); }
.lsheet__seal::after {
  content: ''; position: absolute; inset: 15px; background: #fff;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.js .lsheet { animation: lSheet 1.1s var(--ease-expo) both; }
.js .lsheet--back { animation-delay: .3s; }
.js .lsheet--front { animation-delay: .4s; }
@keyframes lSheet { from { opacity: 0; transform: translateY(30px) rotate(0deg); } }

/* ---------- Body: 3 / 7 / 2 reading split ---------- */
.legal-body { padding: clamp(64px, 8vw, 112px) var(--gutter) clamp(96px, 11vw, 150px); background: var(--cream); color: var(--ink); }
.legal-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); align-items: start; }
.legal-toc { grid-column: 1 / span 3; min-width: 0; }
.legal-content { grid-column: 4 / span 7; min-width: 0; max-width: 680px; }

/* Table of contents: sticky on desktop, a closed <details> below 960px */
.legal-toc summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; list-style: none; cursor: pointer;
  font: 500 11px/1.3 'Geist Mono', ui-monospace, monospace; letter-spacing: .14em; text-transform: uppercase; color: var(--label-on-light);
}
.legal-toc summary::-webkit-details-marker { display: none; }
.legal-toc__body { position: relative; }
.legal-toc ol { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.legal-toc a {
  display: flex; gap: 12px; align-items: baseline; min-height: 36px; padding: 8px 12px; border-radius: 10px;
  font-size: 14.5px; line-height: 1.35; color: var(--body-on-light); transition: color var(--dur-2) var(--ease);
}
.legal-toc a span { flex: none; min-width: 20px; font: 500 11.5px/1.35 'Geist Mono', ui-monospace, monospace; letter-spacing: .04em; color: var(--label-on-light); transition: color var(--dur-2) var(--ease); }
.legal-toc a:hover { color: var(--ink); }
.legal-toc a.is-active, .legal-toc a.is-active span { color: var(--red-deep); }
.legal-toc a:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }
.legal-toc__rail, .legal-toc__pill { display: none; }

@media (min-width: 960px) {
  .legal-toc {
    position: sticky; top: 110px; max-height: calc(100vh - 140px); overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: none; padding-right: 12px;
  }
  .legal-toc::-webkit-scrollbar { display: none; }
  .legal-toc summary { padding: 0 0 16px 18px; pointer-events: none; cursor: default; }
  .legal-toc__body { padding-left: 18px; }
  /* the rail fills with your progress through the document */
  .legal-toc__rail { display: block; position: absolute; left: 0; top: 6px; bottom: 6px; width: 2px; border-radius: 1px; background: var(--line-l2); overflow: hidden; }
  .legal-toc__fill { position: absolute; inset: 0; background: var(--red); transform: scaleY(0); transform-origin: top; will-change: transform; }
  /* the active pill slides to the current section */
  .legal-toc__pill {
    display: block; position: absolute; left: 18px; right: 0; top: 0; height: var(--h, 36px); border-radius: 10px;
    background: rgba(215, 55, 43, .08); box-shadow: inset 0 0 0 1px rgba(215, 55, 43, .16);
    transform: translateY(var(--y, 0px)); opacity: 0;
    transition: transform .45s var(--ease-out), height .45s var(--ease-out), opacity .3s var(--ease);
  }
  .legal-toc__pill.is-on { opacity: 1; }
  .legal-toc__pill.is-snap { transition: opacity .3s var(--ease); }
}

/* ---------- Document ---------- */
.legal-intro { font-size: clamp(18px, 1.5vw, 20px); line-height: 1.65; letter-spacing: -.01em; color: var(--ink); }
.legal-summary {
  margin: 40px 0 0; padding: clamp(24px, 3vw, 34px); border-radius: var(--r-md);
  background: var(--paper); border: 1px solid var(--line-l); box-shadow: var(--sh-card-l);
}
.legal-summary h2 {
  display: flex; align-items: center; gap: 12px; margin-bottom: 18px;
  font: 500 11.5px/1.3 'Geist Mono', ui-monospace, monospace; letter-spacing: .14em; text-transform: uppercase; color: var(--red-deep);
}
.legal-summary h2::before { content: ''; flex: none; width: 22px; height: 2px; background: var(--red); }
.legal-summary ul { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.legal-summary li { position: relative; padding-left: 34px; font-size: 16.5px; line-height: 1.6; color: var(--ink); }
.legal-summary li::before {
  content: ''; position: absolute; left: 0; top: 2px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--red) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4L18 8'/%3E%3C/svg%3E") center / 12px no-repeat;
}

.legal-section { scroll-margin-top: 110px; margin-top: 56px; padding-top: 40px; border-top: 1px solid var(--line-l2); }
.legal-section h2 { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; font-size: 26px; font-weight: 500; line-height: 1.2; letter-spacing: -.025em; color: var(--ink); }
.legal-num { flex: none; min-width: 26px; font: 500 12px/1 'Geist Mono', ui-monospace, monospace; letter-spacing: .08em; color: var(--red-deep); transform: translateY(-2px); }
.legal-section h3 { margin: 30px 0 10px; font-size: 19px; font-weight: 500; line-height: 1.3; letter-spacing: -.02em; color: var(--ink); }
.legal-section p, .legal-section li { font-size: 18px; line-height: 1.75; color: var(--body-on-light); }
.legal-section p + p { margin-top: 16px; }
.legal-section ul { display: grid; gap: 10px; margin: 14px 0 0; padding-left: 22px; }
.legal-section ul + p { margin-top: 18px; }
.legal-section li { padding-left: 4px; }
.legal-section li::marker { color: var(--red); }
.legal-section strong { font-weight: 600; color: var(--ink); }
.legal-content a:not(.card__cta):not(.link-arrow) { color: var(--red-deep); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color var(--dur-1); }
.legal-content a:not(.card__cta):not(.link-arrow):hover { color: var(--red); }

/* Closing ink card and the cross-link */
.legal-cta {
  position: relative; overflow: hidden; margin-top: 80px; padding: clamp(30px, 4vw, 48px); border-radius: var(--r-lg);
  background: radial-gradient(70% 110% at 100% 0%, rgba(215, 55, 43, .32), transparent 62%), var(--ink);
  border: 1px solid var(--line-d); box-shadow: var(--sh-raise), var(--sh-float-l); color: var(--cream);
}
.legal-cta::before {
  content: ''; position: absolute; left: 10%; right: 10%; top: 0; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(239, 90, 76, .75), transparent);
}
.legal-cta__title { font-size: clamp(26px, 2.6vw, 38px); font-weight: 500; line-height: 1.08; letter-spacing: -.03em; color: var(--cream); }
.legal-cta p { max-width: 30em; margin-top: 14px; font-size: 16.5px; line-height: 1.6; color: var(--muted-light); }
.legal-cta__btn { margin-top: 28px; min-height: 48px; padding-inline: 24px; box-shadow: 0 14px 34px -14px rgba(215, 55, 43, .9); }
.legal-also { display: flex; flex-wrap: wrap; gap: 14px 32px; margin-top: 36px; }
.legal-also .link-arrow { position: relative; display: inline-block; font-size: 16px; transition: color var(--dur-1); }
.legal-also .link-arrow::after { content: ''; position: absolute; inset: -12px -8px; }
.legal-also .link-arrow span { display: inline-block; margin-left: 4px; transition: transform .35s var(--ease); }
.legal-also .link-arrow:hover span { transform: translateX(4px); }

/* ---------- Tablet and phone ---------- */
@media (max-width: 959px) {
  .legal-hero { min-height: 0; padding-bottom: 64px; }
  .legal-hero__grid { grid-template-columns: minmax(0, 1fr); }
  .lsheets { display: none; }
  .legal-grid { grid-template-columns: minmax(0, 1fr); row-gap: 40px; }
  .legal-toc, .legal-content { grid-column: 1 / -1; }
  .legal-content { max-width: 680px; }
  .legal-toc { max-width: 680px; border-radius: var(--r-md); background: var(--paper); border: 1px solid var(--line-l); box-shadow: var(--sh-card-l); }
  .legal-toc summary { min-height: 56px; padding: 0 20px; }
  .legal-toc summary::after {
    content: ''; flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line-l2);
    background: linear-gradient(var(--ink), var(--ink)) center / 11px 1.5px no-repeat, linear-gradient(var(--ink), var(--ink)) center / 1.5px 11px no-repeat;
    transition: transform .35s var(--ease);
  }
  .legal-toc[open] summary::after { transform: rotate(45deg); }
  .legal-toc__body { padding: 0 8px 12px; }
  .legal-toc a { min-height: 44px; align-items: center; }
  .legal-toc a span { line-height: 1; }
}
@media (max-width: 599px) {
  .legal-hero { padding-bottom: 56px; }
  .legal-lede { margin-top: 20px; }
  .legal-meta { margin-top: 24px; }
  .legal-hero hr.legal-hero__rule { margin-top: 24px; }
  .legal-section { margin-top: 44px; padding-top: 32px; }
  .legal-section h2 { font-size: 23px; gap: 12px; }
  .legal-section p, .legal-section li { font-size: 17px; line-height: 1.7; }
  .legal-cta { margin-top: 64px; }
  .legal-cta__btn { width: 100%; justify-content: center; }
}

/* ---------- Reduced motion: still sheets, instant pill ---------- */
@media (prefers-reduced-motion: reduce) {
  .lsheets__float, .lsheet { animation: none !important; }
  .legal-toc__pill { transition: none; }
}
