@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* Page defaults */
body {
  --surface-primary: var(--colour-neutral-0);
  font-family: "Inter", sans-serif;
  font-size: 14px;
  line-height: 20px;
  background-color: var(--surface-primary);
  display: flex;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
  padding: var(--spacing-56px) var(--spacing-32px);
  justify-content: center;
  align-items: flex-start;
  margin: 0 !important;
}

html[data-theme="dark"] body {
  --surface-primary: #0C0B09;
}

html[data-platform="app"] body {
  padding: 0 0 var(--spacing-56px);
}

/* Page layout */
.privacy-page {
  display: flex;
  padding-bottom: var(--spacing-24px);
  max-width: 958px;
  align-items: flex-start;
  gap: var(--spacing-32px);
  flex: 1 0 0;
}

/* Sidebar */
.privacy-sidebar {
  position: relative;
  background: var(--surface-primary);
  display: flex;
  min-width: 282px;
  max-width: 320px;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: var(--spacing-0);
  flex: 0 0 clamp(282px, calc(100% - var(--spacing-32px) - 360px), 320px);
  padding: var(--spacing-40px, 40px) 0;
}

/* Dark theme */
html[data-theme="dark"] .privacy-sidebar {
  --text-primary: var(--colour-neutral-0);
  --icon-default: var(--colour-neutral-0);
}

html[data-platform="app"] .privacy-sidebar {
  padding: 20px 0;
}

/* Return to website */
.privacy-back-link {
  text-decoration: none;
  cursor: pointer;
  display: flex;
  padding: 0 var(--spacing-16px);
  align-items: center;
  gap: var(--spacing-8px);
  align-self: stretch;
}

.privacy-back-link .privacy-back-text {
  color: var(--text-secondary);
  font-family: "Inter", sans-serif;
  font-size: 15px;
  font-style: normal;
  font-weight: 600;
  line-height: 20px;
  text-decoration-line: underline;
  text-decoration-style: solid;
  text-decoration-skip-ink: none;
  text-decoration-thickness: auto;
  text-underline-offset: auto;
}

.privacy-back-link .privacy-back-icon {
  color: var(--icon-default);
  width: 24px !important;
  height: 24px !important;
}

.privacy-back-link:focus-visible {
  outline: var(--border-width-focus) solid currentColor;
  outline-offset: 2px;
}

/* Contents navigation */
.privacy-contents {
  display: flex;
  padding: var(--spacing-16px) var(--spacing-0);
  flex-direction: column;
  align-items: flex-start;
  gap: var(--spacing-0);
  align-self: stretch;
}

html[data-platform="app"] .privacy-contents {
  padding: 0;
}

.privacy-contents-title {
  display: flex;
  box-sizing: border-box;
  min-height: 40px;
  align-items: center;
  align-self: stretch;
  margin: 0;
  color: var(--text-primary);
  font-family: Inter;
  font-size: 16px;
  font-style: normal;
  font-weight: 600;
  line-height: 24px;
  padding: 0 var(--spacing-16px);
}

.privacy-contents-toggle {
  display: none;
}

.privacy-contents-panel {
  display: flex;
  flex-direction: column;
  align-self: stretch;
}

.privacy-contents-links {
  display: flex;
  flex-direction: column;
  align-self: stretch;
}

.privacy-contents-links > .privacy-contents-link {
  text-decoration: none;
  display: flex;
  box-sizing: border-box;
  min-height: 40px;
  padding: 0 var(--spacing-16px);
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  align-self: stretch;
  text-align: left;
  color: var(--text-muted);
  font-family: Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-style: normal;
  font-weight: 500;
  line-height: 18px;
}

/* Dark theme */
html[data-theme="dark"] .privacy-back-link .privacy-back-text,
html[data-theme="dark"] .privacy-contents-title {
  color: var(--text-secondary, #ECECEC);
}

.privacy-contents-links > .privacy-contents-link:focus-visible {
  color: var(--takeaway-primary);
  font-weight: 600;
  border-radius: var(--radius-control);
  background: var(--takeaway-secondary, rgba(249, 95, 9, 0.04));
}

html[data-theme="dark"] .privacy-contents-links > .privacy-contents-link:focus-visible {
  border-radius: var(--radius-control, 4px);
}

.privacy-contents-links > .privacy-contents-link:focus-visible {
  outline: var(--border-width-focus) solid currentColor;
  outline-offset: 2px;
}

html[data-platform="app"] .privacy-sidebar .privacy-contents-links > .privacy-contents-link:is(:hover, :focus, :active) {
  color: var(--text-muted);
  font-weight: 500;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
}

/* Policy content layout */
.privacy-content {
  display: flex;
  box-sizing: border-box;
  min-width: 360px;
  max-width: 606px;
  padding: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--spacing-24px);
  flex: 1 1 606px;
  color: var(--text-primary) !important;
  font-family: Inter;
  font-size: 18px;
  font-style: normal;
  font-weight: 600;
  line-height: 24px;
}

html[data-platform="app"] .privacy-content {
  padding: 0 var(--spacing-16px);
}

/* Policy heading and update date */
.privacy-content .privacy-header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: var(--spacing-8px);
}

.privacy-content .privacy-title {
  margin: 0;
  color: var(--takeaway-primary);
  font-family: Inter;
  font-size: 36px;
  font-style: normal;
  font-weight: 800;
  line-height: 44px;
}

.privacy-content .privacy-updated-label,
.privacy-content .privacy-updated-value {
  color: var(--text-secondary);
  font-family: Inter;
  font-size: 15px;
  font-style: normal;
  line-height: 20px;
}

.privacy-content .privacy-updated-label {
  font-weight: 600;
}

.privacy-content .privacy-updated-value {
  font-weight: 400;
}

/* Policy sections */
.privacy-content .section {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  align-self: stretch;
}

.privacy-content .subheading {
  margin: 0;
  color: var(--text-primary) !important;
  font-family: Inter;
  font-size: 20px;
  font-style: normal;
  font-weight: 700;
  line-height: 26px;
}

.privacy-content .privacy-subsection-title {
  scroll-margin-top: var(--spacing-16px);
  margin: 0;
  color: var(--text-primary);
  font-family: "Inter", sans-serif;
  font-size: 16px !important;
  font-style: normal;
  font-weight: 600;
  line-height: 24px;
}

.privacy-content .subheading + .paragraph,
.privacy-content .privacy-subsection-title + .paragraph,
.privacy-content .privacy-subsection-title + .privacy-paragraphs > .paragraph:first-child,
.privacy-content .privacy-subsection-title + .note,
.privacy-content .gdpr-subject-deletion > .privacy-policy-group > .paragraph:first-child {
  margin-top: var(--spacing-4px);
}

.privacy-content .paragraph.privacy-disclosures-summary,
.privacy-content .paragraph.privacy-publication-summary,
.privacy-content .paragraph.privacy-rights-requirements,
.privacy-content .paragraph.privacy-rights-withholding,
.privacy-content .paragraph.privacy-information-types,
.privacy-content .paragraph.privacy-information-uses,
.privacy-content .paragraph.privacy-disclosure-reasons {
  margin-top: var(--spacing-8px, 8px);
}

.privacy-content .paragraph {
  margin: 0;
  color: var(--text-secondary, #ECECEC) !important;
  font-family: Inter;
  font-size: 16px;
  font-style: normal;
  font-weight: 400;
  line-height: 24px;
}

.privacy-content .privacy-paragraphs {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-8px);
  align-self: stretch;
  color: var(--text-secondary, #ECECEC);
  font-family: "Inter", sans-serif;
  font-size: 16px;
  font-style: normal;
  font-weight: 400;
  line-height: 24px;
}

.privacy-content .privacy-paragraphs > .paragraph {
  align-self: stretch;
  color: var(--text-secondary, #ECECEC) !important;
}

.privacy-content .privacy-paragraphs-bold {
  overflow-wrap: anywhere;
  color: var(--takeaway-primary) !important;
  font-family: "Inter", sans-serif;
  font-size: 16px;
  font-style: normal;
  font-weight: 600;
  line-height: 24px;
  text-decoration-line: underline;
  text-decoration-style: solid;
  text-decoration-skip-ink: auto;
  text-decoration-thickness: auto;
  text-underline-offset: auto;
  text-underline-position: from-font;
}

html[data-theme="dark"] .privacy-content .paragraph,
html[data-theme="dark"] .privacy-content .privacy-paragraphs {
  color: var(--text-secondary, #ECECEC) !important;
}

.privacy-content .gdpr-subject-deletion > .privacy-policy-group + .note-background {
  margin-top: var(--spacing-16px, 16px);
}

.privacy-policy-group {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  gap: var(--spacing-16px);
}

/* Lists and dividers */
.privacy-content .privacy-list {
  padding: 0;
  padding-inline-start: 24px;
  align-self: stretch;
  list-style-position: outside;
}

.privacy-content .privacy-list > li {
  margin: 0;
  padding: 0;
}

.privacy-content .privacy-list > li + li {
  margin-top: var(--spacing-4px);
}

.privacy-content .spacer {
  width: 100%;
  margin: calc(var(--spacing-20px) - var(--spacing-4px)) 0;
  padding: 0;
  border: 0;
  border-top: 1px solid var(--border-default);
  align-self: stretch;
  flex-shrink: 0;
}

/* Note */
.note {
  margin: 0;
}

.privacy-content .note-background {
  display: flex;
  padding: var(--spacing-12px) var(--spacing-16px);
  flex-direction: column;
  align-items: flex-start;
  align-self: stretch;
  border-radius: var(--radius-container);
  background: var(--surface-muted);
}

.privacy-content .note {
  color: var(--text-muted);
  font-family: Inter;
  font-size: 15px;
  font-style: normal;
  font-weight: 400;
  line-height: 22px;
}

/* Back to top */
.back-to-top {
  --back-to-top-background: var(--button-tertiary-background);
  --back-to-top-border: var(--button-tertiary-border);
  position: fixed;
  right: 15px;
  bottom: 15px;
  z-index: 995;
  display: flex;
  box-sizing: border-box;
  width: 48px;
  height: 48px;
  padding: 0;
  justify-content: center;
  align-items: center;
  border-radius: var(--radius-pill);
  border: var(--border-width-default) solid var(--back-to-top-border);
  background: var(--back-to-top-background);
  color: var(--button-tertiary-foreground);
  font-size: 24px;
  cursor: pointer;
}

[data-theme="dark"] .back-to-top {
  --back-to-top-background: #0C0B09;
  --back-to-top-border: var(--colour-neutral-700);
}

.back-to-top[hidden] {
  display: none;
}

.back-to-top:focus-visible {
  outline: var(--border-width-focus) solid currentColor;
  outline-offset: 3px;
}

@media (hover: hover) {
  .privacy-contents-links > .privacy-contents-link:hover {
    color: var(--takeaway-primary);
    font-weight: 600;
    border-radius: var(--radius-control, 4px);
    background: var(--takeaway-secondary, rgba(249, 95, 9, 0.04));
  }

  .back-to-top:hover {
    border: var(--border-width-default) solid
      var(--button-tertiary-border-hover);
    background: var(--button-tertiary-background-hover);
    color: var(--button-tertiary-foreground-hover);
  }
}

.back-to-top:active {
  border-color: var(--button-tertiary-border-pressed);
  background: var(--button-tertiary-background-pressed);
  color: var(--button-tertiary-foreground-pressed);
}

/* Desktop layout */
@media (width > 760px) {
  body {
    --privacy-sidebar-top: var(--spacing-56px);
  }

  html[data-platform="app"] body {
    --privacy-sidebar-top: var(--spacing-32px);
    padding: var(--spacing-32px) var(--spacing-32px)
      var(--spacing-56px) var(--spacing-32px);
  }

  .privacy-sidebar {
    position: sticky;
    top: var(--privacy-sidebar-top);
    box-sizing: border-box;
    max-height: calc(100vh - var(--privacy-sidebar-top));
    max-height: calc(100dvh - var(--privacy-sidebar-top));
    overflow-y: auto;
    scrollbar-width: none;
    justify-content: flex-start;
  }

  .privacy-sidebar::-webkit-scrollbar {
    display: none;
  }

  html[data-platform="app"] .privacy-content {
    gap: var(--spacing-8px);
  }
}

/* Suppress the browser tap overlay on devices without hover support. */
@media (hover: none) {
  .privacy-page a,
  .privacy-contents-toggle,
  .back-to-top {
    -webkit-tap-highlight-color: transparent;
  }
}

/* Mobile layout: sidebar becomes a dropdown. */
@media (width <= 760px) {
  /* Stack the sidebar above the policy. */
  body {
    padding: 0;
    padding-bottom: 56px;
  }

  html[data-platform="app"] .privacy-sidebar {
    padding: 0;
  }

  .privacy-page {
    flex-direction: column;
    min-width: 0;
    gap: 0;
  }

  .privacy-sidebar {
    display: contents;
  }

  .privacy-content {
    order: 2;
    min-width: 0;
    max-width: none;
    width: 100%;
    flex: none;
    overflow-wrap: anywhere;
  }

  html[data-platform="web"] .privacy-content {
    padding: var(--spacing-16px) var(--spacing-32px);
  }

  html[data-platform="app"] .privacy-content {
    padding: var(--spacing-16px) var(--spacing-32px) 0;
  }

  .privacy-sidebar > .privacy-back-link {
    order: 1;
    height: auto;
    padding: var(--spacing-12px) var(--spacing-32px);
  }

  .privacy-content .privacy-subsection-title {
    scroll-margin-top: 72px;
  }

  /* Smaller policy heading. */
  .privacy-content .privacy-title {
    font-size: 26px;
    line-height: 32px;
    letter-spacing: 0.26px;
  }

  .privacy-contents {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--surface-primary);
    width: 100%;
    flex: none;
    padding: 0;
    margin-top: 0;
    margin-inline: 0;
  }

  .privacy-contents-title {
    padding: 0;
  }

  .privacy-contents-label {
    display: none;
  }

  .privacy-contents-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 56px;
    box-sizing: border-box;
    padding: 0 var(--spacing-32px, 32px);
    border: 0;
    border-bottom: var(--border-width-default) solid var(--border-default);
    border-inline: 0;
    border-radius: 0;
    box-shadow: none;
    background: var(--surface-primary);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
  }

  .privacy-contents-toggle:focus-visible {
    outline: var(--border-width-focus) solid currentColor;
    outline-offset: 2px;
  }

  /* Dropdown arrow */
  .privacy-contents-toggle .privacy-contents-arrow {
    display: inline-block;
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    background-color: var(--icon-default);
    -webkit-mask: url("../icons/drop-down/arrow_down.svg") center / contain no-repeat;
    mask: url("../icons/drop-down/arrow_down.svg") center / contain no-repeat;
  }

  .privacy-contents-toggle[aria-expanded="true"] .privacy-contents-arrow {
    -webkit-mask-image: url("../icons/drop-down/arrow_up.svg");
    mask-image: url("../icons/drop-down/arrow_up.svg");
  }

  .privacy-contents-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 10;
    overflow: hidden;
    background: var(--surface-primary);
    border-radius: 0 0 var(--radius-sheet, 16px) var(--radius-sheet, 16px);
    box-shadow: 0 8px 16px -4px rgb(0 0 0 / 20%);
  }

  html[data-theme="dark"] .privacy-contents-panel {
    background: var(--surface-canvas, #1E1A1A);
  }

  /* A fade inside the panel indicates more links below or above the visible area. */
  .privacy-contents.has-contents-above .privacy-contents-panel::before,
  .privacy-contents.has-more-contents .privacy-contents-panel::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: var(--spacing-24px);
    z-index: 1;
    pointer-events: none;
  }

  .privacy-contents.has-contents-above .privacy-contents-panel::before {
    top: 0;
    background: linear-gradient(to bottom, var(--surface-primary), transparent);
  }

  .privacy-contents.has-more-contents .privacy-contents-panel::after {
    bottom: 0;
    background: linear-gradient(to bottom, transparent, var(--surface-primary));
  }

  html[data-theme="dark"] .privacy-contents.has-contents-above .privacy-contents-panel::before {
    background: linear-gradient(to bottom, var(--surface-canvas, #1E1A1A), transparent);
  }

  html[data-theme="dark"] .privacy-contents.has-more-contents .privacy-contents-panel::after {
    background: linear-gradient(to bottom, transparent, var(--surface-canvas, #1E1A1A));
  }

  .privacy-contents-links {
    max-height: min(300px, 60vh);
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-width: none;
    padding: var(--spacing-8px, 8px) 0;
  }

  .privacy-contents.is-open .privacy-contents-panel {
    display: flex;
  }

  .privacy-contents-links > .privacy-contents-link {
    padding-inline: var(--spacing-32px);
  }

  .privacy-contents-links::-webkit-scrollbar {
    display: none;
  }
}

/* Narrow screens */
@media (width < 512px) {
  body {
    --spacing-32px: var(--spacing-16px);
  }
}
