/*
 * Styles for the static legal pages (Services & billing, Terms, Privacy).
 * These pages are served as-is from public/, so they cannot import the app CSS.
 * Tokens, base rules, header, section header and footer mirror
 * src/styles/tokens.css, src/styles/base.css, src/components/Section.css,
 * src/components/Button.css and src/sections/landing.css. Keep them in sync.
 */

@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/inter-cyrillic-ext-opsz-normal.woff2) format("woff2-variations");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/inter-cyrillic-opsz-normal.woff2) format("woff2-variations");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/inter-latin-ext-opsz-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/inter-latin-opsz-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --navy: #0e1929;
  --blue: #5180ff;
  --spectrum: #a3c3fe;
  --ice: #d3e2ff;
  --mist: #f3f8fe;
  --white: #ffffff;
  --mist-text: #dfe2e2;

  --ink: var(--navy);
  --ink-2: rgb(14 25 41 / 0.74);
  --ink-3: rgb(14 25 41 / 0.62);
  --paper: var(--white);
  --paper-2: rgb(255 255 255 / 0.74);
  --paper-3: rgb(255 255 255 / 0.6);

  --line: rgb(14 25 41 / 0.08);
  --line-strong: rgb(14 25 41 / 0.14);
  --line-on-navy: rgb(255 255 255 / 0.14);

  /* Theme roles, as in src/styles/tokens.css. The dark theme below re-assigns them. */
  --surface-page: var(--mist);
  --surface-raised: var(--white);
  --surface-sunken: var(--mist);
  --surface-inverse: var(--navy);
  --tint-soft: rgb(211 226 255 / 0.5);
  --header-bg: rgb(243 248 254 / 0.88);
  --strong: var(--navy);
  --on-strong: var(--white);
  --primary-bg: var(--navy);
  --primary-fg: var(--mist-text);
  --primary-hover: #1b2a40;
  --hover-wash: rgb(14 25 41 / 0.04);
  --selection-bg: var(--ice);
  --selection-fg: var(--navy);
  --code-ink: var(--ice);
  color-scheme: light;

  --font-sans: "Inter Variable", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  --h2-size: clamp(2rem, 1.6rem + 1.4vw, 2.5rem);
  --h2-line: 1.2;
  --body-size: 1.0625rem;
  --body-line: 1.647;
  --small-size: 0.875rem;
  --small-line: 1.571;
  --label-size: 0.8125rem;
  --label-line: 1.385;
  --track-display: -0.04em;
  --track-bold: -0.02em;
  --track-body: -0.011em;
  --track-label: 0.01em;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;
  --section-y: clamp(4rem, 2.5rem + 4.5vw, 6.5rem);

  --container: 76rem;
  --gutter: clamp(1.25rem, 0.5rem + 3vw, 2.5rem);
  --header-h: 4.75rem;

  --radius-xs: 6px;
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;

  --shadow-soft: 0 1px 1px rgb(14 25 41 / 0.03), 0 10px 24px -14px rgb(14 25 41 / 0.1);
  --shadow-raised:
    0 1px 2px rgb(14 25 41 / 0.04),
    0 14px 32px -16px rgb(14 25 41 / 0.12),
    0 32px 64px -40px rgb(81 128 255 / 0.28);
  --shadow-primary: 0 1px 2px rgb(14 25 41 / 0.18), 0 10px 22px -12px rgb(14 25 41 / 0.6);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --dur-press: 140ms;
  --dur-hover: 160ms;
  --dur-ui: 220ms;
}

/* Base */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--space-4));
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface-page);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--body-size);
  line-height: var(--body-line);
  letter-spacing: var(--track-body);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p,
li,
td {
  overflow-wrap: break-word;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

::selection {
  background: var(--selection-bg);
  color: var(--selection-fg);
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

.t-h2 {
  font-size: var(--h2-size);
  line-height: var(--h2-line);
  letter-spacing: var(--track-display);
  font-weight: 400;
  font-optical-sizing: auto;
}

.t-small {
  font-size: var(--small-size);
  line-height: var(--small-line);
  letter-spacing: 0;
}

.t-label {
  font-size: var(--label-size);
  line-height: var(--label-line);
  letter-spacing: var(--track-label);
  font-weight: 500;
}

.t-num {
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--ink-2);
}

.faint {
  color: var(--ink-3);
}

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--space-5);
}

.inverse {
  background: var(--surface-inverse);
  color: var(--paper);
  --ink: var(--paper);
  --ink-2: var(--paper-2);
  --ink-3: var(--paper-3);
  --line: var(--line-on-navy);
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-4);
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--strong);
  color: var(--on-strong);
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
  transition: transform var(--dur-ui) var(--ease-out);
}

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

/* Button (secondary, small) */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 2.375rem;
  padding-inline: 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface-raised);
  box-shadow: 0 1px 2px rgb(14 25 41 / 0.05);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition:
    transform var(--dur-press) var(--ease-out),
    background-color var(--dur-hover) ease,
    border-color var(--dur-hover) ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn svg {
  transition: transform var(--dur-ui) var(--ease-out);
}

.btn--lg,
.btn--primary {
  height: 3rem;
  padding-inline: 1.375rem;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
}

.btn--primary {
  border-color: transparent;
  background: var(--primary-bg);
  color: var(--primary-fg);
  box-shadow: var(--shadow-primary);
}

.error-page__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.error-page__code {
  font-size: clamp(6rem, 4rem + 14vw, 13rem);
  line-height: 1;
  letter-spacing: -0.06em;
  font-weight: 400;
  color: var(--code-ink);
  font-variant-numeric: tabular-nums;
}

@media (hover: hover) and (pointer: fine) {
  .btn--primary:hover {
    background: var(--primary-hover);
    border-color: transparent;
  }

  .btn:not(.btn--primary):hover {
    border-color: rgb(14 25 41 / 0.32);
    box-shadow: 0 1px 2px rgb(14 25 41 / 0.06), 0 8px 18px -12px rgb(14 25 41 / 0.3);
  }

  .btn:hover svg {
    transform: translateX(-2px);
  }
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--header-bg);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  height: var(--header-h);
}

.site-header__logo {
  flex-shrink: 0;
}

.site-header__logo img {
  width: clamp(9rem, 8rem + 4vw, 13.5rem);
  height: auto;
}

.site-header__end {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  margin-left: auto;
}

.lang-links {
  display: flex;
  gap: var(--space-1);
}

.lang-links a {
  display: grid;
  place-items: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding-inline: var(--space-2);
  border-radius: 10px;
  color: var(--ink-3);
  transition:
    color var(--dur-hover) ease,
    background-color var(--dur-hover) ease;
}

.lang-links a[aria-current="page"] {
  color: var(--ink);
  background: var(--surface-raised);
  box-shadow: inset 0 0 0 1px var(--line), 0 1px 2px rgb(14 25 41 / 0.05);
}

@media (hover: hover) and (pointer: fine) {
  .lang-links a:hover {
    color: var(--ink);
  }
}

.site-header__back {
  display: none;
}

@media (min-width: 720px) {
  .site-header__back {
    display: inline-flex;
  }
}

@media (max-width: 420px) {
  .lang-links a {
    min-width: 1.75rem;
    padding-inline: var(--space-1);
  }
}

/* Section header: label on the left, heading on the right */

.legal {
  flex: 1;
  padding-block: clamp(3rem, 2rem + 4vw, 5rem) var(--section-y);
}

.section-header {
  row-gap: var(--space-4);
}

.section-header__label {
  grid-column: 1 / -1;
}

.section-header__body {
  grid-column: 1 / -1;
  display: grid;
  gap: var(--space-4);
}

.section-label {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  color: var(--ink-2);
}

.section-label__index {
  position: relative;
  padding-left: 0.875rem;
  color: var(--ink);
}

.section-label__index::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 4px rgb(81 128 255 / 0.14);
  transform: translateY(-50%);
}

.legal__lead {
  max-width: 40rem;
}

.legal__body {
  grid-column: 1 / -1;
  max-width: 46rem;
  margin-top: var(--space-7);
}

.legal__toc {
  display: none;
}

@media (min-width: 900px) {
  .section-header__label {
    grid-column: 1 / span 4;
    padding-top: 0.75rem;
  }

  .section-header__body,
  .legal__body {
    grid-column: 5 / -1;
  }

  .legal__toc {
    display: grid;
    align-content: start;
    gap: var(--space-3);
    grid-column: 1 / span 3;
    grid-row: 1;
    align-self: start;
    position: sticky;
    top: calc(var(--header-h) + var(--space-6));
    max-height: calc(100dvh - var(--header-h) - var(--space-8));
    margin-top: var(--space-7);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .legal__body {
    grid-row: 1;
  }
}

.legal__toc ol {
  display: grid;
  gap: var(--space-2);
  padding: 0;
  list-style: none;
}

.legal__toc a {
  display: block;
  color: var(--ink-3);
  transition: color var(--dur-hover) ease;
}

@media (hover: hover) and (pointer: fine) {
  .legal__toc a:hover {
    color: var(--ink);
  }
}

/* Legal text */

.legal__body > :first-child {
  margin-top: 0;
}

.legal__body h2 {
  margin: var(--space-8) 0 var(--space-4);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
  font-size: 1.5rem;
  line-height: 1.333;
  letter-spacing: var(--track-bold);
  font-weight: 600;
  scroll-margin-top: calc(var(--header-h) + var(--space-4));
}

.legal__body h3 {
  margin: var(--space-6) 0 var(--space-3);
  font-size: 1.0625rem;
  line-height: 1.5;
  letter-spacing: -0.015em;
  font-weight: 600;
}

.legal__body p,
.legal__body ul {
  margin-bottom: var(--space-4);
  color: var(--ink-2);
}

.legal__body strong {
  color: var(--ink);
  font-weight: 600;
}

.legal__body a {
  color: var(--ink);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  transition: text-decoration-thickness var(--dur-hover) ease;
}

@media (hover: hover) and (pointer: fine) {
  .legal__body a:hover {
    text-decoration-thickness: 2px;
  }
}

.legal__body ul {
  display: grid;
  gap: var(--space-2);
  padding: 0;
  list-style: none;
}

.legal__body li {
  position: relative;
  padding-left: var(--space-5);
}

.legal__body li::before {
  content: "";
  position: absolute;
  left: 0.25rem;
  top: 0.7em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
}

/* Callouts: medical notice, translation banner, notes */

.legal__body .alert,
.legal__body .mt-banner,
.legal__body .note {
  margin: var(--space-6) 0;
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  box-shadow: var(--shadow-soft);
}

.legal__body .alert,
.legal__body .mt-banner {
  border-color: transparent;
  background: var(--tint-soft);
  box-shadow: none;
}

.legal__body .mt-banner {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: var(--space-3);
}

.legal__body .mt-banner-icon {
  margin-top: 4px;
  color: var(--blue);
}

.legal__body .alert p,
.legal__body .mt-banner p,
.legal__body .note p {
  margin: 0;
  font-size: var(--small-size);
  line-height: var(--small-line);
  letter-spacing: 0;
}

.legal__body .note p + p {
  margin-top: var(--space-2);
}

/* Tables */

.legal__body .table-wrap {
  margin: var(--space-5) 0 var(--space-6);
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  box-shadow: var(--shadow-soft);
  -webkit-overflow-scrolling: touch;
}

.legal__body table {
  width: 100%;
  min-width: 34rem;
  border-collapse: collapse;
  font-size: var(--small-size);
  line-height: var(--small-line);
  letter-spacing: 0;
}

.legal__body th,
.legal__body td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  vertical-align: top;
}

.legal__body th {
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  font-size: var(--label-size);
  line-height: var(--label-line);
  letter-spacing: var(--track-label);
  font-weight: 500;
}

.legal__body td {
  color: var(--ink-2);
}

.legal__body tbody tr + tr td {
  border-top: 1px solid var(--line);
}

.legal__body td:first-child {
  color: var(--ink);
  font-weight: 500;
}

/* On a phone the columns don't fit: each row becomes a small card, the first cell
   as its title, so nothing is cut off and nothing needs sideways scrolling. */
@media (max-width: 639px) {
  .legal__body .table-wrap {
    overflow: visible;
    border: 0;
    background: none;
    box-shadow: none;
  }

  .legal__body table,
  .legal__body tbody,
  .legal__body tr,
  .legal__body td {
    display: block;
    min-width: 0;
  }

  .legal__body thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .legal__body tbody {
    display: grid;
    gap: var(--space-3);
  }

  .legal__body tr {
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-raised);
    box-shadow: var(--shadow-soft);
  }

  .legal__body td {
    padding: 0;
  }

  .legal__body td + td {
    margin-top: var(--space-2);
  }

  .legal__body tbody tr + tr td {
    border-top: 0;
  }
}

/* Package cards on the Services page, styled like the price table */

.legal__body .pkg {
  margin: 0 0 var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  transition:
    transform var(--dur-ui) var(--ease-out),
    box-shadow var(--dur-ui) var(--ease-out),
    border-color var(--dur-hover) ease;
}

@media (hover: hover) and (pointer: fine) {
  .legal__body .pkg:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-raised);
  }
}

.legal__body .pkg h3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  min-height: 3rem;
  margin: 0;
  padding: var(--space-5) var(--space-5) 0;
  font-size: var(--label-size);
  line-height: var(--label-line);
  letter-spacing: var(--track-label);
  font-weight: 500;
  color: var(--ink-2);
}

.legal__body .pkg .price {
  color: var(--ink);
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.legal__body .pkg p {
  margin: 0;
  padding: var(--space-4) var(--space-5) 0;
}

.legal__body .pkg p:last-child {
  padding-bottom: var(--space-5);
}

.legal__body .pkg .incl {
  margin: var(--space-4) var(--space-5) 0;
  padding: var(--space-4) 0 var(--space-5);
  border-top: 1px solid var(--line);
  font-size: var(--small-size);
  line-height: var(--small-line);
  letter-spacing: 0;
}

.legal__footnote {
  display: grid;
  gap: var(--space-1);
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
}

.legal__footnote p {
  margin: 0;
}

/* Footer */

.site-footer {
  padding-block: var(--space-8) var(--space-6);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.site-footer__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--line);
}

.site-footer__logo img {
  width: clamp(12rem, 10rem + 6vw, 16rem);
  height: auto;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  color: var(--ink-2);
}

.site-footer__links a {
  transition: color var(--dur-hover) ease;
}

.site-footer__links a[aria-current="page"] {
  color: var(--ink);
}

@media (hover: hover) and (pointer: fine) {
  .site-footer__links a:hover {
    color: var(--ink);
  }
}

.site-footer__text {
  padding-top: var(--space-5);
}

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

  .legal__body .pkg:hover {
    transform: none;
  }
}

/* Dark theme, only when the visitor chose it on the main site. Light is the default.
   Mirrors :root[data-theme="dark"] in src/styles/tokens.css. */
:root[data-theme="dark"] {
  --ink: var(--mist);
  --ink-2: rgb(243 248 254 / 0.74);
  --ink-3: rgb(243 248 254 / 0.6);
  --line: rgb(255 255 255 / 0.08);
  --line-strong: rgb(255 255 255 / 0.14);
  --shadow-soft: 0 1px 1px rgb(0 0 0 / 0.25), 0 10px 24px -14px rgb(0 0 0 / 0.55);

  --surface-page: var(--navy);
  --surface-raised: #15233a;
  --surface-sunken: rgb(255 255 255 / 0.05);
  --surface-inverse: #08111d;
  --tint-soft: rgb(81 128 255 / 0.12);
  --header-bg: rgb(14 25 41 / 0.82);
  --strong: var(--mist);
  --on-strong: var(--navy);
  --primary-bg: var(--mist-text);
  --primary-fg: var(--navy);
  --primary-hover: var(--white);
  --hover-wash: rgb(255 255 255 / 0.06);
  --selection-bg: rgb(81 128 255 / 0.45);
  --selection-fg: var(--white);
  --code-ink: rgb(81 128 255 / 0.4);
  --shadow-raised: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px -12px rgb(0 0 0 / 0.55);
  color-scheme: dark;
}

/* The header logo file is navy; on the dark canvas it is shown light. */
:root[data-theme="dark"] .site-header__logo img {
  filter: brightness(0) invert(0.96);
}
