/* Shared style for the policy pages: privacy, terms, refunds.
 *
 * These are long documents that people skim under pressure — usually looking for one
 * clause about a refund or their data. The layout is built around findability: a sticky
 * contents rail on desktop, scroll-spy highlighting, and generous type. Colours come from
 * the --ui-* tokens in unified_theme.css so the pages track the rest of the storefront.
 */

.policy-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px 72px;
}

/* ---------- Header ---------- */

.policy-hero {
  padding: 56px 0 32px;
  border-bottom: 1px solid var(--ui-line, #e7e7ed);
  margin-bottom: 36px;
}

.policy-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ui-brand, #0071e3);
  background: rgba(0, 113, 227, 0.09);
  padding: 6px 13px;
  border-radius: 999px;
  margin-bottom: 18px;
}

.policy-hero h1 {
  font-size: clamp(2rem, 5vw, 2.9rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 14px;
  color: var(--ui-text, #1d1d1f);
}

.policy-lede {
  font-size: clamp(1rem, 2.2vw, 1.14rem);
  line-height: 1.65;
  color: var(--ui-muted, #6e6e73);
  max-width: 68ch;
  margin: 0 0 20px;
}

.policy-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  font-size: 0.88rem;
  color: var(--ui-muted, #6e6e73);
}

.policy-meta strong {
  color: var(--ui-text, #1d1d1f);
  font-weight: 600;
}

/* ---------- Two-column body ---------- */

.policy-layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

.policy-toc {
  position: sticky;
  /* Clears the fixed navbar. */
  top: 88px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.policy-toc h2 {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ui-muted, #6e6e73);
  margin: 0 0 14px;
}

.policy-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: toc;
}

.policy-toc li {
  counter-increment: toc;
  margin-bottom: 2px;
}

.policy-toc a {
  display: block;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--ui-muted, #6e6e73);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.policy-toc a::before {
  content: counter(toc) ".";
  margin-right: 7px;
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
}

.policy-toc a:hover {
  background: rgba(0, 0, 0, 0.035);
  color: var(--ui-text, #1d1d1f);
  text-decoration: none;
}

/* Applied by the scroll-spy in policy_pages.js. */
.policy-toc a.is-active {
  background: rgba(0, 113, 227, 0.08);
  border-left-color: var(--ui-brand, #0071e3);
  color: var(--ui-brand, #0071e3);
  font-weight: 600;
}

/* ---------- Sections ---------- */

.policy-body {
  min-width: 0;
}

.policy-section {
  background: var(--ui-surface, #fff);
  border: 1px solid var(--ui-line, #e7e7ed);
  border-radius: 16px;
  padding: 30px 32px;
  margin-bottom: 18px;
  /* Anchor links must not land under the fixed navbar. */
  scroll-margin-top: 96px;
}

.policy-section h2 {
  font-size: 1.28rem;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  color: var(--ui-text, #1d1d1f);
}

.policy-section h3 {
  font-size: 1.02rem;
  margin: 26px 0 10px;
  color: var(--ui-text, #1d1d1f);
}

.policy-section p,
.policy-section li {
  color: #51545c;
  line-height: 1.72;
  margin-top: 0;
}

.policy-section p {
  margin-bottom: 14px;
}

.policy-section > :last-child {
  margin-bottom: 0;
}

.policy-section ul,
.policy-section ol {
  padding-left: 1.25rem;
  margin-bottom: 14px;
}

.policy-section li {
  margin-bottom: 8px;
}

.policy-section a {
  color: var(--ui-brand, #0071e3);
  text-decoration: none;
}

.policy-section a:hover {
  text-decoration: underline;
}

/* ---------- Callouts ---------- */

.policy-note {
  border-left: 3px solid var(--ui-brand, #0071e3);
  background: rgba(0, 113, 227, 0.05);
  border-radius: 0 10px 10px 0;
  padding: 15px 18px;
  margin: 18px 0;
  font-size: 0.94rem;
}

.policy-note.is-warning {
  border-left-color: var(--ui-warn, #9d5a00);
  background: rgba(157, 90, 0, 0.06);
}

.policy-note strong {
  color: var(--ui-text, #1d1d1f);
}

/* ---------- Comparison table ---------- */

/* Wrapper scrolls horizontally rather than letting the table blow out the mobile layout. */
.policy-table-wrap {
  overflow-x: auto;
  margin: 18px 0;
  border: 1px solid var(--ui-line, #e7e7ed);
  border-radius: 12px;
  -webkit-overflow-scrolling: touch;
}

.policy-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.91rem;
  min-width: 520px;
}

.policy-table th,
.policy-table td {
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid var(--ui-line, #e7e7ed);
  vertical-align: top;
}

.policy-table th {
  background: var(--ui-surface-soft, #fbfbfd);
  font-weight: 600;
  color: var(--ui-text, #1d1d1f);
  white-space: nowrap;
}

.policy-table td {
  color: #51545c;
  line-height: 1.6;
}

.policy-table tr:last-child td {
  border-bottom: none;
}

/* ---------- Contact footer card ---------- */

.policy-contact {
  margin-top: 34px;
  background: linear-gradient(135deg, #1e1b4b 0%, #0052c8 100%);
  border-radius: 18px;
  padding: 34px 32px;
  color: #fff;
}

.policy-contact h2 {
  font-size: 1.32rem;
  margin: 0 0 10px;
  color: #fff;
  letter-spacing: -0.02em;
}

.policy-contact p {
  color: rgba(255, 255, 255, 0.84);
  margin: 0 0 20px;
  line-height: 1.65;
  max-width: 56ch;
}

.policy-contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.policy-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 10px;
  font-size: 0.94rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease;
}

.policy-btn:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

.policy-btn-primary {
  background: #fff;
  color: #0052c8;
}

.policy-btn-ghost {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .policy-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  /* Collapse the rail into a <details> disclosure so it does not push the content down. */
  .policy-toc {
    position: static;
    max-height: none;
    background: var(--ui-surface, #fff);
    border: 1px solid var(--ui-line, #e7e7ed);
    border-radius: 12px;
    padding: 8px 12px;
  }

  .policy-toc[open] {
    padding-bottom: 12px;
  }

  .policy-toc summary {
    cursor: pointer;
    padding: 10px 2px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ui-muted, #6e6e73);
    list-style: none;
  }

  .policy-toc summary::-webkit-details-marker {
    display: none;
  }

  .policy-toc summary::after {
    content: "▾";
    float: right;
    transition: transform 200ms ease;
  }

  .policy-toc[open] summary::after {
    transform: rotate(180deg);
  }
}

@media (max-width: 640px) {
  .policy-shell {
    padding: 0 14px 52px;
  }

  .policy-hero {
    padding: 34px 0 24px;
    margin-bottom: 24px;
  }

  .policy-section {
    padding: 22px 19px;
    border-radius: 13px;
  }

  .policy-contact {
    padding: 26px 22px;
  }

  .policy-contact-actions {
    flex-direction: column;
  }

  .policy-btn {
    justify-content: center;
  }
}

/* On desktop the rail is a plain nav, so neutralise the mobile <details> affordance. */
@media (min-width: 901px) {
  .policy-toc summary {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .policy-toc a,
  .policy-btn {
    transition: none;
  }

  .policy-btn:hover {
    transform: none;
  }
}
