/* Legal pages (terms, privacy, cancel, accessibility) + thanks page.
   Loaded after tokens.css, base.css, components.css and page-hero.css. Owner: T6, redesign L (7.11.2026).
   The language of the mockups (docs/design/mockups/): a light sky at the top, a navy pill tag, a navy
   title with the short red swoosh, white cards with a soft blue shadow, dark-blue number circles.
   The legal pages are reading pages: a compact opening (no side pictures) and a 72ch column. */

/* ================= Legal pages ================= */

/* the sky fades out quickly: the document itself sits on white */
.legal-page {
  background: linear-gradient(180deg, #D9E9FB 0, #E8F2FD 200px, #F4F8FE 380px, #FFFFFF 600px);
  padding-bottom: var(--space-8);
}

/* ---------- Compact opening (page-hero.css classes, smaller title) ---------- */
.page-hero--compact { padding-block: var(--space-6) var(--space-5); }
.page-hero--compact .page-hero__tag { margin-bottom: var(--space-4); }
.page-hero--compact .page-hero__title {
  font-size: clamp(2.1rem, 1.45rem + 2.7vw, 3.3rem);
  line-height: 1.12;
  margin-bottom: calc(var(--space-4) + .1em);
  text-wrap: balance;
}
.page-hero--compact .page-hero__lead { max-width: 42rem; font-size: 1.06rem; }
@media (max-width: 479.98px) {
  .page-hero--compact { padding-block: var(--space-5) var(--space-4); }
  .page-hero--compact .page-hero__lead { font-size: 1rem; text-align: start; text-wrap: pretty; }
}

.legal__version {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 10px;
  margin-top: var(--space-4);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .78);
  border: 1px solid rgba(15, 63, 140, .10);
  color: var(--navy-900);
  font-size: .875rem;
}

/* ---------- Reading layout: table of contents | document ---------- */
.legal { display: grid; gap: var(--space-6); align-items: start; padding-top: var(--space-2); }
@media (min-width: 900px) {
  .legal { grid-template-columns: 260px minmax(0, 1fr); gap: var(--space-7); }
  .legal__toc { position: sticky; top: calc(var(--header-h) + var(--space-4)); }
}

/* Table of contents: <details> so it folds on phones; legal-pages.js opens it on desktop */
.toc {
  background: var(--white);
  border: 1px solid rgba(15, 63, 140, .08);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
}
.toc summary {
  list-style: none;
  cursor: pointer;
  min-height: 52px;
  padding: 14px 18px;
  font-weight: 700;
  color: var(--navy-900);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.toc summary::-webkit-details-marker { display: none; }
/* the focus ring sits inside the card, so it is never cut by the card edge (S, 7.11: no visible change on focus before) */
.toc summary:focus-visible { outline-offset: -3px; border-radius: 18px; }
.toc summary::after {
  content: "";
  width: 9px; height: 9px;
  border-inline-end: 2px solid var(--navy-700);
  border-bottom: 2px solid var(--navy-700);
  transform: translateY(-2px) rotate(45deg);
  transition: transform var(--transition);
  margin-inline-end: 4px;
}
.toc[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.toc ol {
  margin: 0;
  padding: 0 10px 12px;
  list-style: none;
  counter-reset: toc;
  display: grid;
  gap: 2px;
}
.toc li { counter-increment: toc; }
/* a list of links styled on its own: no underline (base.css underlines links in running text only) */
.toc a {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 10px;
  color: var(--ink);
  font-size: .95rem;
  line-height: 1.4;
  text-decoration: none;
}
.toc a::before {
  content: counter(toc);
  color: var(--navy-700);
  font-weight: 700;
  min-width: 1.5em;
  font-variant-numeric: tabular-nums;
}
.toc a:hover { background: #EEF5FE; color: var(--navy-900); text-decoration: none; }
/* touch: every entry is a 44px target (final design review 23) */
@media (pointer: coarse) {
  .toc a { min-height: 44px; align-items: center; padding-block: 10px; }
}
@media (min-width: 900px) {
  .toc summary { pointer-events: none; min-height: 0; padding-bottom: 10px; }
  .toc summary::after { display: none; }
  .toc ol {
    max-height: calc(100dvh - var(--header-h) - 150px);
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #C3D3EA transparent;
  }
  /* legal-pages.js adds .toc--more while entries are hidden below: the last visible line fades out
     instead of being cut in the middle (final design review 16) */
  .toc--more ol {
    -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 44px), transparent);
    mask-image: linear-gradient(180deg, #000 calc(100% - 44px), transparent);
  }
}

/* ---------- The document: comfortable reading column, numbered h2 ---------- */
.legal__body { max-width: 72ch; counter-reset: sec; }
.legal__body > section {
  padding-block: var(--space-6) var(--space-5);
  border-top: 1px solid #E3EAF4;
  scroll-margin-top: calc(var(--header-h) + 24px);
}
.legal__body > section:first-of-type { border-top: 0; padding-top: 0; }
.legal__body h2 {
  counter-increment: sec;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: var(--space-3);
  font-size: 1.4rem;
  line-height: 1.35;
  color: var(--navy-900);
}
/* section numbers carry information: other sections refer to them ("סעיף 11") */
.legal__body h2::before {
  content: counter(sec);
  flex: none;
  display: grid; place-items: center;
  width: 34px; height: 34px;
  margin-top: -2px;
  border-radius: 50%;
  background: var(--navy-700);
  color: var(--white);
  font-size: .95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 10px rgba(15, 63, 140, .22);
}
.legal__body h3 { margin: var(--space-5) 0 var(--space-2); font-size: 1.1rem; color: var(--navy-900); }
.legal__body p + p, .legal__body p + ul, .legal__body p + ol, .legal__body ul + p, .legal__body ol + p { margin-top: .75em; }
.legal__body li + li { margin-top: .4em; }
.legal__body li::marker { color: var(--navy-700); }
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: var(--space-3);
  border: 1px solid #DCE6F3;
  border-radius: 14px;
}
.legal__body table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.legal__body th, .legal__body td { text-align: start; vertical-align: top; padding: 11px 14px; border-bottom: 1px solid #E3EAF4; }
.legal__body th + th, .legal__body td + td { border-inline-start: 1px solid #E3EAF4; }
.legal__body tbody tr:last-child td { border-bottom: 0; }
.legal__body th { background: #EEF5FE; color: var(--navy-900); font-weight: 700; }
.legal__body tbody tr:nth-child(even) td { background: #F8FBFF; }

/* Quoted legal text (D.1–D.5 blocks) */
.legal-quote {
  margin: var(--space-4) 0;
  padding: 18px 20px;
  border: 1px solid rgba(15, 63, 140, .10);
  border-radius: 16px;
  background: #F5F9FF;
}
.legal-quote p + p { margin-top: .75em; }

/* Key facts strip (cancel page) */
.facts { display: grid; gap: var(--space-3); margin: 0 0 var(--space-6); }
@media (min-width: 640px) { .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.fact {
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--white);
  border: 1px solid rgba(15, 63, 140, .08);
  box-shadow: 0 6px 18px rgba(15, 63, 140, .07);
}
.fact__num { display: block; font-size: 1.4rem; font-weight: 700; color: var(--navy-900); line-height: 1.25; margin-bottom: 4px; }
.fact__label { color: #3E4E6A; font-size: .92rem; line-height: 1.5; }

/* Checkbox texts shown as read-only samples (not real inputs) */
.sample-box { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px dashed var(--blue-300); border-radius: 12px; background: var(--white); }
.sample-box + .sample-box { margin-top: var(--space-3); }
.sample-box__mark { flex: none; width: 20px; height: 20px; margin-top: 3px; border: 2px solid var(--navy-700); border-radius: 4px; }

/* Ways to cancel (cancel page): 1 column, 2 from 640px, 3 from 900px (final design review 15) */
.ways { display: grid; gap: var(--space-3); margin-top: var(--space-4); }
@media (min-width: 640px) { .ways { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.way {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  border: 1px solid rgba(15, 63, 140, .08);
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 6px 18px rgba(15, 63, 140, .07);
}
.way__icon { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: #EAF2FD; color: var(--navy-700); }
.way__icon svg { width: 22px; height: 22px; }
.way strong { display: block; color: var(--navy-900); margin-bottom: 2px; }
.way a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; overflow-wrap: anywhere; }
.ways + p { margin-top: var(--space-4); }
@media (min-width: 900px) {
  .ways { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .way { flex-direction: column; gap: 10px; }
}

/* Cancel form: one white card, like the contact form */
.cancel-form {
  margin-top: var(--space-4);
  padding: var(--space-5) var(--space-4);
  background: var(--white);
  border: 1px solid rgba(15, 63, 140, .08);
  border-radius: var(--radius-card-lg, 24px);
  box-shadow: var(--shadow-soft);
}
@media (min-width: 640px) { .cancel-form { padding: var(--space-6); } }
.cancel-form__demo { margin-bottom: var(--space-5); font-size: .92rem; line-height: 1.5; padding: 10px 14px; }
.cancel-form__demo svg { width: 20px; height: 20px; }
.cancel-form .grid { gap: 0 var(--space-4); }
.cancel-form .field__label { font-weight: 700; color: var(--navy-900); }
.cancel-form__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; margin-top: var(--space-2); }
.cancel-form__actions .btn { border-radius: var(--radius-btn, 12px); }
.form-note { font-size: .9rem; color: var(--muted); }
.cancel-form__privacy { margin-top: var(--space-3); font-size: .875rem; color: var(--muted); }
#cancel-success, #cancel-fail { margin-top: var(--space-4); border-radius: 16px; }
.cancel-demo-line { display: block; margin-top: 8px; }

/* links inside notes and alerts are running text too: underlined, not only blue (a11y 1, WCAG 1.4.1) */
.legal-page .alert a, .thanks-page .alert a, .cancel-demo-line a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* ================= Thanks page ================= */
/* the sky (page-hero.css .sky-page) already runs into the footer wave (S, 7.11) */
.thanks-page.sky-page { padding-bottom: var(--space-7); }
.thanks-page .sky-deco { width: min(34vw, 420px); }
@media (max-width: 639.98px) { .thanks-page .sky-deco { opacity: .42; } }

.thanks {
  max-width: 720px;
  margin-inline: auto;
  padding-top: var(--space-5);
  display: grid;
  gap: var(--space-5);
}
/* grid children must be allowed to shrink, or the order code widens the column (final design review 2) */
.thanks > *, .thanks .stack > * { min-width: 0; }
.thanks .stack > * + * { margin-top: var(--space-5); }

.thanks__hero { text-align: center; display: grid; justify-items: center; }
.thanks__icon {
  width: 64px; height: 64px;
  margin-bottom: var(--space-4);
  border-radius: 50%;
  background: var(--ok);
  color: var(--white);
  display: grid; place-items: center;
  box-shadow: 0 10px 24px rgba(27, 156, 91, .28), 0 0 0 8px rgba(255, 255, 255, .75);
}
.thanks__icon svg { width: 36px; height: 36px; }
/* the one moment on this page: the check lands and draws itself (off with reduced motion) */
@media (prefers-reduced-motion: no-preference) {
  .thanks__icon { animation: thanks-pop 560ms cubic-bezier(0.16, 1, 0.3, 1) both; }
  .thanks__icon path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: thanks-draw 420ms cubic-bezier(0.16, 1, 0.3, 1) 260ms forwards; }
}
@keyframes thanks-pop { from { transform: scale(.72); } to { transform: scale(1); } }
@keyframes thanks-draw { to { stroke-dashoffset: 0; } }

.thanks__title {
  font-size: clamp(2.6rem, 1.9rem + 3.4vw, 4.25rem);
  margin-bottom: var(--space-3);
}
.thanks__title-sub {
  display: block;
  margin-top: .42em;
  font-size: clamp(1.3rem, 1rem + 1.2vw, 1.95rem);
  letter-spacing: 0;
  line-height: 1.2;
}
.thanks__title--long { font-size: clamp(1.8rem, 1.35rem + 1.9vw, 2.7rem); line-height: 1.2; text-wrap: balance; }
.thanks__hero > p:not(.page-hero__tag) { max-width: 36rem; color: #22324D; text-wrap: pretty; }
#pay-line { font-size: 1.08rem; color: #22324D; }

/* The order code: a white card, the code in a quiet inset box (like the order-number card in pay-bit) */
.thanks__order {
  width: 100%;
  margin-top: var(--space-5);
  padding: 20px 16px;
  display: grid;
  justify-items: center;
  gap: 10px;
  background: var(--white);
  border: 1px solid rgba(15, 63, 140, .08);
  border-radius: var(--radius-card, 20px);
  box-shadow: var(--shadow-soft);
}
@media (min-width: 640px) { .thanks__order { padding: 24px 28px; } }
.thanks__order-label { color: #3E4E6A; font-size: .95rem; font-weight: 500; }
.thanks__order-id {
  display: block;
  max-width: 100%;
  font-size: clamp(1.15rem, 6.4vw, 2.3rem);
  font-weight: 700;
  letter-spacing: .03em;
  line-height: 1.2;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--navy-900);
  background: #F4F8FE;
  border: 1px solid #DCE7F5;
  border-radius: 14px;
  padding: 8px 12px;
}
@media (min-width: 640px) { .thanks__order-id { padding: 10px 20px; } }
.thanks__order-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 440px;
  margin-top: 4px;
}
.thanks__order-actions .btn { flex: 1 1 150px; }
.thanks__keep { max-width: 36rem; margin-top: var(--space-4); color: #3E4E6A; line-height: 1.6; text-wrap: pretty; }
.thanks__keep strong { color: var(--navy-900); }

/* every card on the page: the soft white card of the redesigned pages */
.thanks-page .card {
  border: 1px solid rgba(15, 63, 140, .08);
  border-radius: var(--radius-card, 20px);
  box-shadow: var(--shadow-soft);
}
.thanks-page .btn { border-radius: var(--radius-btn, 12px); }
@media (max-width: 479.98px) { .thanks-page .card { padding: 20px 16px; } }
.thanks-page .alert { border-radius: 16px; }

/* Summary: label | value rows; values sit next to their labels, also the e-mail (final design review 3.6) */
.thanks__summary dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0 20px; margin: 0; }
.thanks__summary dt, .thanks__summary dd { padding-block: 10px; border-top: 1px solid #EDF2F9; }
.thanks__summary dl > dt:first-of-type, .thanks__summary dl > dt:first-of-type + dd { border-top: 0; padding-top: 0; }
.thanks__summary dt { color: #3E4E6A; }
.thanks__summary dd { margin: 0; font-weight: 500; color: var(--navy-900); }
.thanks__summary dd.ltr { text-align: right; overflow-wrap: anywhere; }
/* Wrapper that adds no box of its own (keeps dt/dd in the dl grid); base.css [hidden] still hides it. */
.contents { display: contents; }
/* narrow phones: the label above its value, so a long e-mail keeps the full width */
@media (max-width: 399.98px) {
  .thanks__summary dl { grid-template-columns: minmax(0, 1fr); }
  .thanks__summary dd { border-top: 0; padding-top: 0; }
  .thanks__summary dt { padding-bottom: 2px; font-size: .9rem; }
  .thanks__summary dl > dt:first-of-type + dd { padding-top: 0; }
}

.thanks__next-title { font-size: 1.35rem; color: var(--navy-900); margin-bottom: var(--space-4); }
.thanks__steps { counter-reset: ts; list-style: none; padding: 0; display: grid; gap: var(--space-4); }
.thanks__steps li { counter-increment: ts; display: flex; gap: 14px; align-items: flex-start; line-height: 1.6; color: #22324D; }
.thanks__steps li::before {
  content: counter(ts);
  flex: none; width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--navy-700); color: var(--white);
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(15, 63, 140, .22);
}
.thanks__steps li > div { min-width: 0; }
.thanks__steps strong { display: block; color: var(--navy-900); }
.thanks__steps .thanks__inline { display: inline; color: inherit; }
.thanks__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; }
.thanks__fine { text-align: center; color: var(--muted); }

@media print {
  .toc, .thanks__actions, .site-header, .disclosure, .sky-deco { display: none !important; }
  .legal { display: block; }
  .legal-page, .thanks-page { background: none !important; }
}
