/*
 * developers.myleapp.fr — the documentation of the Myle API.
 *
 * The vitrine's look (legal.html, privacy.html): Inter served by Myle, the brand greens, the slate
 * greys, white cards on a pale background. One small script on the guides, `examples.js`: the code
 * examples as tabs, one per language, with a Copy button; without it every language shows under its
 * label, so the pages still read for search engines and for those who block scripts.
 *
 * The header, the guide list and the footer of every page are written by
 * `web/scripts/developers-layout.py` between its markers; edit them there, not in the pages.
 */
:root {
  --brand-50: #f0fff4;
  --brand-100: #c6f6d5;
  --brand-200: #9ae6b4;
  --brand-500: #38a169;
  --brand-600: #2f855a;
  --brand-700: #276749;
  --brand-900: #365314;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --amber-50: #fffbeb;
  --amber-500: #d97706;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.7;
  font-size: 16px;
  /* The footer at the bottom of the screen when the page is short, after the text otherwise. */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.footer {
  margin-top: auto;
}

a {
  color: var(--brand-600);
}

a:hover {
  color: var(--brand-700);
}

/* Header */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--gray-200);
}

.nav-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.85rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--gray-900);
}

.logo img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.logo-text {
  font-size: 1.35rem;
  font-weight: 400;
}

.logo-text strong {
  font-weight: 600;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
}

.nav-links a {
  text-decoration: none;
  color: var(--gray-600);
  font-size: 0.95rem;
  font-weight: 500;
}

.nav-links a:hover,
.nav-links a[aria-current='page'] {
  color: var(--brand-600);
}

.nav-links .lang {
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  padding: 0.2rem 0.75rem;
  font-size: 0.85rem;
}

.nav-cta {
  background: var(--brand-600);
  color: white !important;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
}

.nav-cta:hover {
  background: var(--brand-700);
}

/* Page header (home, changelog, terms) */
.page-header {
  padding: 4.5rem 2rem 3rem;
  background: linear-gradient(135deg, var(--brand-50) 0%, white 100%);
  text-align: center;
}

.page-header h1 {
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  color: var(--gray-900);
  font-weight: 400;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.page-header p {
  color: var(--gray-600);
  font-size: 1.1rem;
  max-width: 640px;
  margin: 0 auto;
}

.page-header .meta {
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: var(--gray-500);
}

/* Layout: the guide list on the left, the text on the right */
.layout {
  max-width: 1440px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
  /* A column item with auto side margins does not stretch: the width does it. */
  width: 100%;
}

.layout.single {
  grid-template-columns: minmax(0, 1fr);
  max-width: 1120px;
}

.sidebar {
  position: sticky;
  top: 5rem;
  font-size: 0.92rem;
}

.sidebar h2 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
  margin: 0 0 0.6rem;
}

.sidebar ol,
.sidebar ul {
  list-style: none;
  margin-bottom: 1.5rem;
}

.sidebar li a {
  display: block;
  padding: 0.3rem 0.75rem;
  border-left: 2px solid var(--gray-200);
  color: var(--gray-600);
  text-decoration: none;
}

.sidebar li a:hover {
  color: var(--brand-700);
  border-left-color: var(--brand-200);
}

.sidebar li a[aria-current='page'] {
  color: var(--brand-700);
  border-left-color: var(--brand-500);
  font-weight: 600;
}

/* The text */
.doc {
  background: white;
  border-radius: 16px;
  padding: 2.75rem 3rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.05);
  min-width: 0;
  /* A word longer than the line (a bare URL) breaks rather than widening the page. */
  overflow-wrap: break-word;
}

.doc h1 {
  font-size: 2.2rem;
  font-weight: 400;
  color: var(--gray-900);
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

.doc .lead {
  font-size: 1.1rem;
  color: var(--gray-600);
  margin-bottom: 2rem;
}

.doc h2 {
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--gray-900);
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--brand-100);
  scroll-margin-top: 5rem;
}

.doc h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gray-800);
  margin: 1.75rem 0 0.6rem;
  scroll-margin-top: 5rem;
}

.doc p,
.doc ul,
.doc ol,
.doc table,
.doc pre,
.doc .note {
  margin-bottom: 1rem;
}

.doc p,
.doc li {
  color: var(--gray-700);
}

.doc ul,
.doc ol {
  padding-left: 1.5rem;
}

.doc li {
  margin-bottom: 0.4rem;
}

.doc code {
  font-family: var(--mono);
  font-size: 0.87em;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  padding: 0.05rem 0.3rem;
  overflow-wrap: anywhere;
  /* The badge takes no more height than the text around it, so lines stay evenly spaced. */
  line-height: 1;
}

/* Inline code in the text is never cut (`?` / `tag=Bio`): it moves to the next line whole, and a value wider than the
   column scrolls inside its badge. */
.doc p code,
.doc li code {
  white-space: nowrap;
  overflow-wrap: normal;
  display: inline-block;
  max-width: 100%;
  overflow-x: auto;
  /* An inline-block that scrolls has its bottom edge as baseline: lowered so its text sits on the line's baseline. */
  vertical-align: -0.3em;
}

.doc pre {
  background: var(--gray-900);
  color: var(--gray-100);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.6;
}

.doc pre code {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: inherit;
  overflow-wrap: normal;
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
  /* A table wider than the text scrolls in its own box (on a phone) instead of squeezing words. */
  display: block;
  overflow-x: auto;
}

.doc th,
.doc td {
  text-align: left;
  /* Every cell of a row starts on the same line, code badge or plain text. */
  vertical-align: baseline;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--gray-200);
}

.doc th {
  color: var(--gray-800);
  font-weight: 600;
  background: var(--gray-50);
}

.doc td {
  color: var(--gray-700);
}

/* Code in a table never breaks: its column takes the room it needs, and the table scrolls. */
.doc th code,
.doc td code {
  white-space: nowrap;
  overflow-wrap: normal;
}

/*
 * Code examples (`web/scripts/developers-examples.py` writes them from `sdk/examples/`). Without
 * JavaScript: every language under its label. With `examples.js`: one bar of tabs and a Copy button.
 */
.doc .example {
  margin-bottom: 1rem;
  background: var(--gray-900);
  border-radius: 10px;
  overflow: hidden;
}

.doc .example pre {
  margin: 0;
  border-radius: 0;
}

.doc .example-panel + .example-panel {
  border-top: 1px solid var(--gray-700);
}

.doc .example-label,
.example-name {
  color: var(--gray-400);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.5;
}

.doc .example-label {
  margin: 0;
  padding: 0.5rem 1.25rem;
  background: var(--gray-800);
}

.example-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 0.6rem 0 0.5rem;
  background: var(--gray-800);
  border-bottom: 1px solid var(--gray-700);
}

.example-tabs {
  display: flex;
  min-width: 0;
  /* More tabs than the width (a phone, and the SDKs to come): they scroll, the Copy button stays. */
  overflow-x: auto;
  scrollbar-width: none;
}

/* Set by examples.js when the tabs are wider than their bar: the cut tab fades out, so it reads as « more to
   scroll », not as a typo. */
.example-tabs.overflowing {
  mask-image: linear-gradient(to right, #000 calc(100% - 1.5rem), transparent);
}

.example-tabs [role='tab'] {
  flex: none;
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--gray-400);
  font: 500 0.85rem/1.5 var(--font);
  padding: 0.55rem 0.75rem 0.45rem;
  cursor: pointer;
  white-space: nowrap;
}

.example-tabs [role='tab']:hover {
  color: white;
}

.example-tabs [role='tab'][aria-selected='true'] {
  color: white;
  border-bottom-color: var(--brand-500);
}

.example-name {
  padding: 0.5rem 0.75rem;
}

.example-copy {
  flex: none;
  appearance: none;
  background: none;
  border: 1px solid var(--gray-600);
  border-radius: 6px;
  color: var(--gray-200);
  font: 500 0.78rem/1.4 var(--font);
  padding: 0.2rem 0.65rem;
  cursor: pointer;
}

.example-copy:hover {
  border-color: var(--gray-400);
  color: white;
}

.example-copy.done {
  border-color: var(--brand-500);
  color: var(--brand-200);
}

.example :focus-visible {
  outline: 2px solid var(--brand-200);
  outline-offset: -2px;
}

.example-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.example [hidden] {
  display: none !important;
}

/* Between the script's start and its tabs: one language only, so the page does not jump. */
.examples-js .example:not(.example-ready) > .example-panel ~ .example-panel,
.examples-js .example:not(.example-ready) .example-label {
  display: none;
}

.note {
  background: var(--brand-50);
  border-left: 4px solid var(--brand-500);
  border-radius: 8px;
  padding: 1rem 1.25rem;
}

.note.coming {
  background: var(--amber-50);
  border-left-color: var(--amber-500);
}

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

.next {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-weight: 500;
}

/* Home: the guide cards */
.cards {
  list-style: none;
  padding: 0 !important;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.cards li {
  margin: 0;
}

.cards a {
  display: block;
  height: 100%;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  text-decoration: none;
  color: var(--gray-700);
  background: white;
}

.cards a:hover {
  border-color: var(--brand-200);
  background: var(--brand-50);
}

.cards strong {
  display: block;
  color: var(--gray-900);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.cards span {
  font-size: 0.92rem;
}

/* The draft banner of the terms */
.draft-banner {
  background: #b91c1c;
  color: white;
  text-align: center;
  font-weight: 600;
  padding: 0.75rem 1rem;
  letter-spacing: 0.02em;
}

/* Footer */
.footer {
  background: var(--gray-900);
  color: var(--gray-300);
  padding: 3rem 2rem 2rem;
}

.footer-container {
  max-width: 1440px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
}

.footer p {
  font-size: 0.9rem;
  margin-top: 0.75rem;
}

.footer .logo-text {
  color: white;
}

.footer h2 {
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.footer-col a {
  display: block;
  color: var(--gray-400);
  text-decoration: none;
  font-size: 0.93rem;
  margin-bottom: 0.6rem;
}

.footer-col a:hover {
  color: white;
}

/* Reference: Scalar takes the page under the header */
.reference-body .nav {
  position: relative;
}

/* « Use my Myle account » above the reference (reference-connect.js) */
.reference-connect {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.75rem 2rem;
  font-size: 0.9rem;
  color: var(--gray-600);
}

.reference-connect[hidden],
.reference-connect [hidden] {
  display: none;
}

.reference-connect button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  padding: 0.45rem 1rem;
}

.reference-connect-button {
  background: var(--brand-600);
  border: 1px solid var(--brand-600);
  color: white;
  font-weight: 600;
}

.reference-connect-button:hover {
  background: var(--brand-700);
}

.reference-connect-status {
  color: var(--brand-700);
  font-weight: 600;
}

.reference-connect-logout {
  background: white;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}

.reference-connect-logout:hover {
  border-color: var(--gray-400);
}

.reference-connect.is-connected .reference-connect-hint {
  display: none;
}

.reference-connect-message,
.reference-connect-note {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.85rem;
}

.reference-connect-note a {
  color: var(--brand-700);
}

/* 404 */
.notfound {
  width: 100%;
  max-width: 34rem;
  margin: 6rem auto;
  padding: 0 1.5rem;
  text-align: center;
}

.notfound img {
  border-radius: 10px;
  margin-bottom: 1.5rem;
}

.notfound h1 {
  font-weight: 400;
  font-size: 2rem;
  color: var(--gray-900);
  margin-bottom: 0.75rem;
}

.notfound p {
  color: var(--gray-600);
  margin-bottom: 1rem;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    order: 2;
  }

  .footer-container {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  /* On a phone the header wraps on three lines: it scrolls away instead of covering the page. */
  .nav {
    position: static;
  }

  .nav-container {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.75rem 1.25rem;
  }

  .nav-links {
    gap: 0.9rem;
  }

  .layout {
    padding: 1.25rem 0.75rem 3rem;
  }

  .doc {
    padding: 1.75rem 1.25rem;
  }

  .example-tabs [role='tab'] {
    padding-left: 0.55rem;
    padding-right: 0.55rem;
  }

  .footer-container {
    grid-template-columns: 1fr;
  }
}
