:root {
  color-scheme: light;
  --bg: #f8f8fc;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --text: #17151f;
  --muted: #666171;
  --line: rgba(83, 57, 145, 0.16);
  --brand: #633ce5;
  --brand-2: #8b5cf6;
  --brand-soft: #ece5ff;
  --shadow: 0 18px 60px rgba(54, 35, 102, 0.12);
  --focus: #2649d8;
  --glow-purple: rgba(111, 67, 222, 0.32);
  --glow-blue: rgba(83, 153, 239, 0.29);
  --glow-light: rgba(255, 255, 255, 0.84);
  --grid-line: rgba(95, 63, 214, 0.065);
  --max: 1120px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #03050b;
  --surface: rgba(17, 23, 34, 0.69);
  --surface-solid: #151c29;
  --text: #f7f4ff;
  --muted: #d4dae8;
  --line: rgba(156, 168, 190, 0.28);
  --brand: #9270ed;
  --brand-2: #6f4df2;
  --brand-soft: rgba(50, 37, 85, 0.82);
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.38);
  --focus: #bda8ff;
  --glow-purple: rgba(103, 44, 232, 0.34);
  --glow-blue: rgba(18, 108, 229, 0.30);
  --glow-light: rgba(40, 166, 217, 0.14);
  --grid-line: rgba(120, 149, 214, 0.075);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  overflow-x: clip;
  scroll-behavior: smooth;
}

body {
  position: relative;
  isolation: isolate;
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

img {
  max-width: 100%;
}

button {
  font: inherit;
}

body::before,
body::after {
  position: fixed;
  pointer-events: none;
  content: "";
}

body::before {
  z-index: -2;
  inset: -28vmax;
  background:
    radial-gradient(circle at 23% 72%, var(--glow-purple) 0 8%, transparent 31%),
    radial-gradient(circle at 77% 28%, var(--glow-blue) 0 7%, transparent 29%),
    radial-gradient(circle at 51% 48%, var(--glow-light) 0 6%, transparent 27%);
  transform-origin: center;
  animation: ambient-drift 13.5s linear infinite;
  will-change: transform;
}

body::after {
  z-index: -1;
  inset: 0;
  opacity: 0.72;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, transparent, #000 12%, #000 88%, transparent);
}

@keyframes ambient-drift {
  0% {
    transform: translate3d(-3%, 1%, 0) rotate(0deg) scale(1);
  }
  33% {
    transform: translate3d(4%, -4%, 0) rotate(4deg) scale(1.04);
  }
  66% {
    transform: translate3d(-1%, 5%, 0) rotate(-3deg) scale(0.98);
  }
  100% {
    transform: translate3d(-3%, 1%, 0) rotate(0deg) scale(1);
  }
}

a {
  color: var(--brand);
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 20;
  padding: 0.65rem 0.9rem;
  border-radius: 0.75rem;
  color: #fff;
  background: #111;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(18px) saturate(1.25);
}

.header-inner,
.page,
.footer-inner {
  width: min(calc(100% - 2rem), var(--max));
  margin-inline: auto;
}

.header-inner {
  min-height: 72px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f2f2f2;
  box-shadow: 0 8px 24px rgba(55, 35, 108, 0.13);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.site-nav {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
}

.site-nav a {
  padding: 0.48rem 0.8rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.language-menu {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.language-menu summary {
  min-width: 48px;
  padding: 0.52rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
  list-style: none;
  cursor: pointer;
}

.language-menu summary::-webkit-details-marker {
  display: none;
}

.language-panel {
  position: fixed;
  top: calc(100% + 0.55rem);
  right: 0;
  z-index: 30;
  display: grid;
  width: 172px;
  padding: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: color-mix(in srgb, var(--surface-solid) 94%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(1.3);
}

.language-panel[hidden] {
  display: none !important;
}

.language-panel a {
  padding: 0.52rem 0.65rem;
  border-radius: 0.7rem;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
  text-decoration: none;
}

.language-panel a:hover,
.language-panel a[aria-current="page"] {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
}

.mobile-menu-toggle {
  position: relative;
  display: none;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
}

.mobile-menu-toggle span {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: 18px;
  height: 1.5px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 220ms ease, opacity 180ms ease;
}

.mobile-menu-toggle span:first-child { transform: translate(-50%, -6px); }
.mobile-menu-toggle span:nth-child(2) { transform: translate(-50%, -50%); }
.mobile-menu-toggle span:last-child { transform: translate(-50%, 4.5px); }
.mobile-menu-toggle[aria-expanded="true"] span:first-child { transform: translate(-50%, -50%) rotate(45deg); }
.mobile-menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.mobile-menu-toggle[aria-expanded="true"] span:last-child { transform: translate(-50%, -50%) rotate(-45deg); }

.theme-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.page {
  padding-block: clamp(2.2rem, 7vw, 5.5rem);
}

.hero,
.legal-header {
  max-width: 820px;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}

.eyebrow {
  margin: 0 0 0.65rem;
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  line-height: 1.18;
  letter-spacing: -0.03em;
  overflow-wrap: break-word;
}

h1 {
  margin: 0;
  font-size: clamp(2.35rem, 8vw, 5rem);
}

.legal-header h1 {
  font-size: clamp(2.2rem, 6vw, 4.25rem);
  overflow-wrap: normal;
  word-break: normal;
}

h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.4rem, 3vw, 2.05rem);
}

h3 {
  margin: 1.4rem 0 0.55rem;
  font-size: 1.08rem;
}

.lead {
  max-width: 68ch;
  margin: 1.15rem 0 0;
  color: var(--muted);
  font-size: clamp(1.03rem, 2vw, 1.23rem);
}

.meta {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.1rem;
}

.card {
  grid-column: span 6;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.25);
}

.card-wide {
  grid-column: 1 / -1;
}

.card p:last-child,
.legal-section p:last-child {
  margin-bottom: 0;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.25rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.7rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-solid);
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.button-primary {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

.feature-list,
.legal-section ul {
  padding-left: 1.25rem;
}

.feature-list li + li,
.legal-section li + li {
  margin-top: 0.45rem;
}

.legal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 1.25rem;
  align-items: start;
}

.legal-content {
  display: grid;
  gap: 1rem;
}

.legal-section,
.toc {
  padding: clamp(1.2rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.25);
}

.legal-section h2 {
  scroll-margin-top: 92px;
}

.toc {
  position: sticky;
  top: 92px;
}

.toc strong {
  display: block;
  margin-bottom: 0.75rem;
}

.toc ol,
.toc ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.toc li + li {
  margin-top: 0.35rem;
}

.notice {
  padding: 1rem 1.1rem;
  border-left: 4px solid var(--brand);
  border-radius: 0.8rem;
  background: var(--brand-soft);
}

.site-footer {
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.4rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-inner p {
  margin: 0;
}

@media (max-width: 840px) {
  .legal-layout {
    grid-template-columns: 1fr;
  }

  .toc {
    position: static;
    order: -1;
  }
}

@media (max-width: 680px) {
  .header-inner,
  .page,
  .footer-inner {
    width: min(calc(100% - 1.1rem), var(--max));
  }

  .site-header {
    background: color-mix(in srgb, var(--bg) 86%, transparent);
  }

  .header-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 64px;
    gap: 0.65rem;
    padding-block: 0.5rem;
  }

  .brand {
    min-width: 0;
    gap: 0.55rem;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 12px;
  }

  .brand-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-actions { gap: 0.4rem; }
  .language-menu summary { min-width: 44px; min-height: 40px; padding-inline: 0.65rem; }
  .icon-button { width: 40px; height: 40px; }

  .site-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    justify-content: flex-start;
    width: calc(100% + 1.1rem);
    margin-inline: -0.55rem;
    padding: 0.15rem 0.55rem 0.25rem;
    overflow-x: auto;
    scroll-padding-inline: 0.55rem;
    scroll-snap-type: x proximity;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }

  .site-nav::-webkit-scrollbar { display: none; }

  .site-nav a {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding-inline: 0.8rem;
    text-align: center;
    white-space: nowrap;
    scroll-snap-align: start;
  }

  .page { padding-block: 1.8rem 3.5rem; }

  .hero,
  .legal-header {
    margin-bottom: 1.6rem;
  }

  .card {
    grid-column: 1 / -1;
    padding: 1.15rem;
    border-radius: 1.2rem;
  }

  .grid { gap: 0.8rem; }

  .footer-inner {
    flex-direction: column;
    padding-block: 1.2rem;
  }

  .language-panel {
    position: fixed;
    top: 66px;
    right: 0.55rem;
    width: min(292px, calc(100% - 1.1rem));
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.25rem;
    padding: 0.55rem;
  }

  h1 {
    font-size: clamp(2rem, 9vw, 2.8rem);
    overflow-wrap: normal;
    text-wrap: pretty;
    word-break: normal;
    hyphens: auto;
  }

  .legal-header h1 {
    font-size: clamp(1.9rem, 8.5vw, 2.6rem);
    overflow-wrap: normal;
    text-wrap: pretty;
    word-break: normal;
    hyphens: auto;
  }

  .lead { font-size: 1rem; }
  .legal-content { gap: 0.8rem; }
  .legal-section,
  .toc {
    padding: 1.15rem;
    border-radius: 1.15rem;
  }
  .toc ol,
  .toc ul {
    columns: 2;
    column-gap: 1.5rem;
  }
  .toc li {
    break-inside: avoid;
    margin-bottom: 0.35rem;
  }
  .button { min-height: 48px; }
}

@media (max-width: 390px) {
  .header-inner,
  .page,
  .footer-inner {
    width: min(calc(100% - 0.8rem), var(--max));
  }

  .brand-label { font-size: 0.9rem; }
  .site-nav { width: calc(100% + 0.8rem); margin-inline: -0.4rem; padding-inline: 0.4rem; }
  .site-nav a { padding-inline: 0.7rem; font-size: 0.8rem; }
  .language-panel { right: 0.4rem; width: calc(100% - 0.8rem); }
  .page { padding-top: 1.45rem; }
  .legal-header h1 { font-size: clamp(1.75rem, 8.3vw, 2.2rem); }
  .toc ol,
  .toc ul { columns: 1; }
  .card-actions .button { flex: 1 1 100%; }
}

/* A compact, explicit mobile menu replaces the overflowing navigation row. */
@media (max-width: 760px) {
  body::before {
    animation: none;
    transform: none;
    will-change: auto;
  }

  .site-header {
    top: 0;
    padding-top: 8px;
    border-bottom: 0;
    background: transparent;
    backdrop-filter: none;
  }

  .header-inner {
    position: relative;
    width: calc(100% - 16px);
    min-height: 62px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 1fr;
    gap: 8px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface-solid) 78%, transparent);
    box-shadow: 0 12px 34px rgba(45, 31, 84, 0.11);
    -webkit-backdrop-filter: blur(14px) saturate(1.18);
    backdrop-filter: blur(14px) saturate(1.18);
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .header-actions {
    grid-column: 2;
    grid-row: 1;
    gap: 5px;
  }

  .mobile-menu-toggle { display: grid; }

  .site-nav {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    width: 100%;
    max-height: calc(100vh - 96px);
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    margin: 0;
    padding: 9px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: color-mix(in srgb, var(--surface-solid) 98%, transparent);
    box-shadow: 0 18px 44px rgba(45, 31, 84, 0.2);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px) scale(.985);
    transform-origin: top center;
    -webkit-backdrop-filter: blur(16px) saturate(1.15);
    backdrop-filter: blur(16px) saturate(1.15);
    transition: opacity 160ms ease, transform 210ms cubic-bezier(.2,.75,.2,1), visibility 160ms ease;
  }

  .site-header.is-menu-open .site-nav {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
  }

  .site-nav a {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 11px 14px;
    font-size: .9rem;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .language-panel {
    position: fixed;
    top: 78px;
    right: 10px;
    width: min(286px, calc(100vw - 20px));
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    padding: 9px;
  }

  .header-inner,
  .page,
  .footer-inner { width: calc(100% - 16px); }

  .page { padding-block: 1.35rem 3rem; }

  .hero,
  .legal-header { margin-bottom: 1.25rem; }

  h1,
  .legal-header h1 {
    font-size: clamp(1.9rem, 8.2vw, 2.45rem);
    line-height: 1.08;
    letter-spacing: -.04em;
    text-wrap: pretty;
    overflow-wrap: break-word;
    hyphens: auto;
  }

  .lead {
    font-size: .98rem;
    line-height: 1.7;
  }

  .legal-layout,
  .legal-content { gap: .75rem; }

  .legal-section,
  .toc,
  .card {
    padding: 1rem;
    border-radius: 16px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }

  .legal-section h2 { font-size: 1.15rem; line-height: 1.3; }
  .legal-section p { line-height: 1.72; }

  .toc ol,
  .toc ul {
    columns: 1;
    margin-top: .8rem;
  }

  .toc li {
    break-inside: auto;
    margin-bottom: .45rem;
  }

  .toc a {
    display: inline-block;
    padding-block: 3px;
  }

  .card-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .button { width: 100%; min-height: 50px; }
  .footer-inner { gap: .6rem; }
}

@media (max-width: 400px) {
  .header-inner { width: calc(100% - 12px); padding-inline: 8px; }
  .brand-mark { width: 36px; height: 36px; }
  .brand-label { font-size: .88rem; }
  .header-actions { gap: 3px; }
  .mobile-menu-toggle,
  .icon-button { width: 38px; height: 38px; }
  .language-menu summary { width: 38px; min-width: 38px; min-height: 38px; padding: 0; }
  .page,
  .footer-inner { width: calc(100% - 20px); }
  .legal-header h1 {
    font-size: clamp(1.55rem, 7.5vw, 1.9rem);
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
  }
  .language-panel { right: 6px; width: calc(100vw - 12px); }
}

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

  body::before {
    animation: none;
  }
}
