/* Legal pages only. This stylesheet is intentionally independent from the main site. */
html {
  box-sizing: border-box;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

body.legal-page {
  min-width: 0;
  margin: 0;
  overflow-x: hidden;
  color: #1d1d1f;
  background: #f5f5f7;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: clamp(1rem, 0.975rem + 0.08vw, 1.0625rem);
  line-height: 1.72;
  text-rendering: optimizeLegibility;
}

.legal-page a {
  color: inherit;
  text-underline-offset: 0.2em;
  overflow-wrap: anywhere;
}

.legal-page a:focus-visible {
  outline: 3px solid #1d1d1f;
  outline-offset: 4px;
  border-radius: 10px;
}

.legal-header {
  position: sticky;
  z-index: 10;
  top: 0;
  padding-top: max(10px, env(safe-area-inset-top));
  padding-right: max(clamp(12px, 3vw, 32px), env(safe-area-inset-right));
  padding-left: max(clamp(12px, 3vw, 32px), env(safe-area-inset-left));
  pointer-events: none;
}

.legal-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1120px, 100%);
  min-height: 64px;
  margin: 0 auto;
  padding: 7px 9px 7px 14px;
  border: 1px solid rgba(29, 29, 31, 0.1);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.055);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  pointer-events: auto;
}

.legal-back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  transition: background-color 180ms ease, transform 180ms ease;
}

.legal-back-link:hover {
  background: rgba(29, 29, 31, 0.055);
  transform: translateX(-2px);
}

.legal-logo-wrap {
  display: grid;
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 16px;
  background: #f7f7f8;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.legal-logo {
  display: block;
  width: 44px;
  height: 44px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

.legal-main,
.legal-footer__inner {
  width: min(1120px, 100%);
  margin-right: auto;
  margin-left: auto;
}

.legal-main {
  padding: clamp(34px, 6vw, 76px)
    max(clamp(12px, 3vw, 32px), env(safe-area-inset-right))
    clamp(56px, 8vw, 104px)
    max(clamp(12px, 3vw, 32px), env(safe-area-inset-left));
}

.legal-hero {
  max-width: 960px;
  padding: clamp(18px, 3vw, 34px) clamp(4px, 1vw, 12px) clamp(32px, 5vw, 58px);
}

.legal-hero h1 {
  max-width: 100%;
  margin: 0;
  color: #0b0b0c;
  font-size: clamp(2.125rem, 1.48rem + 2.7vw, 4.25rem);
  font-weight: 650;
  line-height: 1.04;
  letter-spacing: -0.045em;
  overflow-wrap: anywhere;
  hyphens: auto;
  text-wrap: balance;
}

.legal-hero__subtitle {
  margin: clamp(18px, 2.3vw, 26px) 0 0;
  color: #48484a;
  font-size: clamp(1.0625rem, 0.98rem + 0.32vw, 1.3125rem);
  font-weight: 500;
  line-height: 1.45;
}

.legal-date {
  margin: 9px 0 0;
  color: #6e6e73;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.legal-document {
  display: grid;
  gap: clamp(14px, 1.8vw, 22px);
}

.legal-section {
  min-width: 0;
  padding: clamp(22px, 3.5vw, 46px);
  border: 1px solid rgba(29, 29, 31, 0.1);
  border-radius: clamp(22px, 2.4vw, 32px);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.035);
  scroll-margin-top: 94px;
}

.legal-section h2 {
  margin: 0 0 clamp(14px, 1.7vw, 20px);
  color: #1d1d1f;
  font-size: clamp(1.25rem, 1.15rem + 0.36vw, 1.5625rem);
  font-weight: 650;
  line-height: 1.28;
  letter-spacing: -0.018em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.legal-section p {
  margin: 0;
  overflow-wrap: anywhere;
}

.legal-section p + p,
.legal-section p + .legal-list,
.legal-section .legal-list + p,
.legal-section .legal-details + p {
  margin-top: 0.9em;
}

.legal-list {
  display: grid;
  gap: 0.48em;
  margin: 0.9em 0 0;
  padding: 0;
  list-style: none;
}

.legal-list li {
  display: grid;
  grid-template-columns: 1.05em minmax(0, 1fr);
  min-width: 0;
}

.legal-list__marker {
  color: #6e6e73;
  user-select: text;
}

.legal-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 28px;
  margin-top: 1em;
}

.legal-details p {
  padding-top: 14px;
  border-top: 1px solid rgba(29, 29, 31, 0.1);
}

.legal-signature {
  margin-top: clamp(24px, 3vw, 38px);
  padding-top: clamp(20px, 2.4vw, 28px);
  border-top: 1px solid rgba(29, 29, 31, 0.1);
  font-weight: 600;
}

.legal-footer {
  padding-right: max(clamp(12px, 3vw, 32px), env(safe-area-inset-right));
  padding-bottom: max(28px, env(safe-area-inset-bottom));
  padding-left: max(clamp(12px, 3vw, 32px), env(safe-area-inset-left));
}

.legal-footer__inner {
  padding: clamp(24px, 3.5vw, 38px);
  border: 1px solid rgba(29, 29, 31, 0.1);
  border-radius: clamp(22px, 2.4vw, 32px);
  background: #ffffff;
}

.legal-footer__label {
  margin: 0 0 14px;
  color: #6e6e73;
  font-size: 0.8125rem;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.legal-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.legal-footer__links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 7px 0;
  color: #424245;
  font-size: 0.9375rem;
  font-weight: 550;
  line-height: 1.4;
  text-decoration-thickness: 1px;
  text-decoration-color: transparent;
  transition: color 180ms ease, text-decoration-color 180ms ease;
}

.legal-footer__links a:hover {
  color: #000000;
  text-decoration-color: currentColor;
}

.legal-footer__links a[aria-current="page"] {
  color: #000000;
  font-weight: 700;
  text-decoration-color: currentColor;
}

@media (max-width: 640px) {
  .legal-header__bar {
    min-height: 60px;
    border-radius: 19px;
  }

  .legal-back-link {
    max-width: calc(100% - 52px);
  }

  .legal-logo-wrap {
    width: 46px;
    height: 46px;
    border-radius: 14px;
  }

  .legal-logo {
    width: 40px;
    height: 40px;
  }

  .legal-main {
    padding-top: 25px;
  }

  .legal-hero h1 {
    max-width: 100%;
    letter-spacing: -0.035em;
  }

  .legal-section {
    border-radius: 22px;
  }

  .legal-details {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .legal-footer__links {
    display: grid;
    gap: 4px;
  }
}

@media (max-width: 360px) {
  .legal-back-link {
    padding-left: 6px;
    font-size: 0.875rem;
  }

  .legal-main {
    padding-right: max(10px, env(safe-area-inset-right));
    padding-left: max(10px, env(safe-area-inset-left));
  }

  .legal-section,
  .legal-footer__inner {
    padding: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .legal-back-link,
  .legal-footer__links a {
    transition: none;
  }
}

@media print {
  @page {
    margin: 16mm 18mm;
  }

  html,
  body.legal-page {
    min-width: 0;
    color: #000000;
    background: #ffffff;
    font-size: 10.5pt;
    line-height: 1.5;
  }

  .legal-header,
  .legal-footer {
    display: none;
  }

  .legal-main {
    width: 100%;
    padding: 0;
  }

  .legal-hero {
    max-width: none;
    padding: 0 0 10mm;
  }

  .legal-hero h1 {
    max-width: none;
    color: #000000;
    font-size: 24pt;
  }

  .legal-hero__subtitle,
  .legal-date {
    color: #000000;
  }

  .legal-document {
    display: block;
  }

  .legal-section {
    padding: 5mm 0;
    border: 0;
    border-top: 0.25pt solid #b8b8b8;
    border-radius: 0;
    background: #ffffff;
    box-shadow: none;
    break-inside: avoid-page;
  }

  .legal-section h2 {
    color: #000000;
    font-size: 14pt;
  }
}
