/* =========================================================================
   Base: reset, typography defaults, accessibility primitives
   ========================================================================= */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--rs-header-h) + 1rem);
  background: var(--rs-bg);
}

body {
  background: var(--rs-bg);
  color: var(--rs-text);
  font-family: var(--rs-font-sans);
  font-size: var(--rs-text-base);
  line-height: var(--rs-leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* A dialog-like surface (mobile menu, search, video) locks the page behind it
   rather than letting it scroll away underneath. */
body.has-drawer,
body.has-modal {
  overflow: hidden;
}

main {
  flex: 1 0 auto;
}

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

img,
video {
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

p,
li,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

/* The display face is condensed, so headings are set tight and loud: this is
   the single strongest signal that the page belongs to this design system. */
h1,
h2,
h3,
h4 {
  font-family: var(--rs-font-display);
  font-weight: var(--rs-weight-bold);
  line-height: var(--rs-leading-snug);
  letter-spacing: var(--rs-tracking-tight);
  color: inherit;
  text-wrap: balance;
}

h1,
h2 {
  line-height: var(--rs-leading-tight);
  text-transform: uppercase;
}

/* `display` on a class beats the browser's own [hidden] rule, so any element
   given both showed anyway. That is why the assistant card was visible before
   a question was asked and stayed visible when its close button was pressed. */
[hidden] {
  display: none !important;
}

h1 {
  font-size: var(--rs-text-4xl);
}
h2 {
  font-size: var(--rs-text-3xl);
}
h3 {
  font-size: var(--rs-text-xl);
}
h4 {
  font-size: var(--rs-text-lg);
}

p {
  text-wrap: pretty;
}

a {
  color: var(--rs-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--rs-duration-fast) var(--rs-ease);
}

a:hover {
  color: var(--rs-link-hover);
}

ul,
ol {
  padding-left: 1.25rem;
}

hr {
  border: none;
  border-top: 1px solid var(--rs-border);
}

:focus-visible {
  outline: 3px solid var(--rs-lime);
  outline-offset: 2px;
  border-radius: var(--rs-radius-sm);
}

::selection {
  background: var(--rs-lime);
  color: #05070c;
}

/* The rails and the page itself get a thin dark scrollbar rather than the
   browser's light default, which flashed white on a black page. */
* {
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
  scrollbar-width: thin;
}

/* ------------------------------------------------------------ a11y helpers */

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -120%);
  z-index: var(--rs-z-toast);
  background: var(--rs-lime);
  color: #05070c;
  padding: var(--rs-space-3) var(--rs-space-5);
  border-radius: 0 0 var(--rs-radius) var(--rs-radius);
  font-weight: var(--rs-weight-bold);
  text-decoration: none;
  transition: transform var(--rs-duration) var(--rs-ease);
}

.skip-link:focus {
  transform: translate(-50%, 0);
  color: #05070c;
}

/* ---------------------------------------------------------------- motion */

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

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------------------ print */

@media print {
  .site-header,
  .site-footer,
  .lang-switcher,
  .btn {
    display: none !important;
  }

  body {
    color: #000;
    background: #fff;
  }
}
