/* ==========================================================================
   BASE: reset, typography, buttons, shared utilities
   ========================================================================== */

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-bg);   /* explicit background, never transparent */
  -webkit-font-smoothing: antialiased;
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  letter-spacing: -0.02em;
  line-height: 1.08;
  font-weight: 700;
}

a {
  color: inherit;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

code,
pre,
.mono {
  font-family: var(--font-mono);
}

.container {
  width: min(100% - 2 * var(--gutter), var(--container-width));
  margin-inline: auto;
}

.section {
  padding-block: var(--section-space);
}

.section--tinted {
  background: var(--color-surface-alt);
}

.section--brand {
  background: var(--color-brand-soft);
}

.section-title {
  font-size: clamp(2rem, 4.2vw, 2.9rem);
  margin-bottom: 12px;
}

.section-lead {
  color: var(--color-muted);
  font-size: 1.05rem;
  max-width: 52ch;
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-brand);
  margin-bottom: 14px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--color-brand-soft);
  color: var(--color-brand);
}

/* Buttons ----------------------------------------------------------------- */
/*
 * Mistral-style button:
 *  - 40px high, 6px radius, medium-weight sans text (not uppercase)
 *  - on hover: a pixel icon slides in from the left, the label moves right,
 *    and the right-hand pixel icon slides out. Timings match mistral.ai (300ms).
 */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  min-width: 40px;
  padding: 0 40px;             /* room for the pixel icons on both sides */
  border: 0;
  border-radius: 6px;          /* rectangle with rounded corners, shared by all buttons */
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.btn__label {
  display: inline-block;
  transition: transform 0.3s ease;
  will-change: transform;
}

/* Pixel icons (shared shape, drawn with a CSS mask so they take currentColor) */
.btn::before,
.btn::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 20px;
  height: 20px;
  margin-top: -10px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath d='M13 25H9v-4h4zM17 21h-4v-4h4zM21 17h-4v-4h4zM17 13h-4V9h4z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath d='M13 25H9v-4h4zM17 21h-4v-4h4zM21 17h-4v-4h4zM17 13h-4V9h4z'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 0.3s ease;
  pointer-events: none;
}

/* Left icon: hidden off to the left, slides in on hover (delay 100ms) */
.btn::before {
  left: 16px;
  transform: translateX(-30px);
}

/* Right icon: visible at the right, slides out on hover */
.btn::after {
  right: 16px;
  transform: translateX(0);
}

.btn:hover::before {
  transform: translateX(0);
  transition-delay: 0.1s;
}

.btn:hover::after {
  transform: translateX(30px);
}

/* Label moves right to make room for the left icon (delay 75ms) */
.btn:hover .btn__label {
  transform: translateX(24px);
  transition-delay: 0.075s;
}

.btn--primary {
  background: #09090b;
  color: #fafafa;
}

.btn--primary:hover {
  background: #18181b;
}

.btn--ghost {
  background: rgba(7, 7, 11, 0.05);
  color: var(--color-text);
}

.btn--ghost:hover {
  background: rgba(7, 7, 11, 0.1);
}

.btn--block {
  width: 100%;
}

/* Accessibility helpers ---------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 3px;
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
