/*
 * Bodylet AI: base: reset, document defaults, typography helpers, layout
 * primitives. Requires ../tokens/tokens.css and ../fonts/fonts.css.
 */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bl-bg);
  color: var(--bl-text);
  scroll-padding-top: 5.5rem;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bl-bg);
  color: var(--bl-text-2);
  font-family: var(--bl-font-sans);
  font-size: var(--bl-text-base);
  font-weight: var(--bl-weight-regular);
  line-height: var(--bl-leading-body);
  /* Code ligatures (>=, ->, --) would misquote commands; off everywhere. */
  font-variant-ligatures: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
dd,
figure,
pre,
blockquote {
  margin: 0;
}

ul[class],
ol[class] {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
h4 {
  color: var(--bl-text);
  font-weight: var(--bl-weight-semibold);
  line-height: var(--bl-leading-snug);
  letter-spacing: var(--bl-tracking-title);
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

a {
  color: var(--bl-accent);
  text-decoration: none;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--bl-accent-hover);
  text-decoration: underline;
}

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

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

code,
kbd,
samp,
pre {
  font-family: var(--bl-font-mono);
  font-size: 0.92em;
  font-variant-ligatures: none;
}

strong,
b {
  color: var(--bl-text);
  font-weight: var(--bl-weight-semibold);
}

hr {
  height: 1px;
  margin: 0;
  border: 0;
  background: var(--bl-border);
}

/* The hidden attribute wins over any component's display value. */
[hidden] {
  display: none !important;
}

::selection {
  background: var(--bl-accent-fill);
  color: var(--bl-text-on-accent);
}

:focus {
  outline: none;
}

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

/* ── Type helpers ───────────────────────────────────────────────────────── */

.bl-display {
  color: var(--bl-text);
  font-size: var(--bl-text-display);
  font-weight: var(--bl-weight-semibold);
  line-height: var(--bl-leading-tight);
  letter-spacing: var(--bl-tracking-display);
  text-wrap: balance;
}

.bl-title {
  color: var(--bl-text);
  font-size: var(--bl-text-title);
  font-weight: var(--bl-weight-semibold);
  line-height: 1.08;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.bl-h2 {
  font-size: var(--bl-text-3xl);
  line-height: 1.12;
}

.bl-h3 {
  font-size: var(--bl-text-xl);
  letter-spacing: -0.02em;
}

.bl-h4 {
  font-size: var(--bl-text-base);
  letter-spacing: -0.01em;
}

.bl-lead {
  color: var(--bl-text-2);
  font-size: clamp(1.0625rem, 0.98rem + 0.4vw, 1.25rem);
  line-height: 1.55;
}

.bl-small {
  font-size: var(--bl-text-sm);
  line-height: var(--bl-leading-ui);
}

.bl-muted {
  color: var(--bl-text-3);
}

.bl-strong {
  color: var(--bl-text);
}

.bl-accent {
  color: var(--bl-accent);
}

.bl-mono {
  font-family: var(--bl-font-mono);
  font-variant-ligatures: none;
  font-variant-numeric: tabular-nums;
}

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

/* Uppercase mono label: section eyebrows, table headers, field captions. */
.bl-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--bl-accent);
  font-family: var(--bl-font-mono);
  font-size: var(--bl-text-xs);
  font-weight: var(--bl-weight-medium);
  line-height: 1;
  letter-spacing: var(--bl-tracking-label);
  text-transform: uppercase;
}

.bl-eyebrow--muted {
  color: var(--bl-text-3);
}

/* A short accent tick before the label. */
.bl-eyebrow--tick::before {
  content: "";
  width: 1.25rem;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.bl-kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 0.1em 0.4em;
  border: 1px solid var(--bl-border-strong);
  border-bottom-width: 2px;
  border-radius: var(--bl-radius-xs);
  background: var(--bl-surface-2);
  color: var(--bl-text);
  font-family: var(--bl-font-mono);
  font-size: var(--bl-text-xs);
  line-height: 1.4;
  text-align: center;
}

/* ── Icons (see ../icons/icons.svg) ─────────────────────────────────────── */

.bl-icon {
  flex: none;
  width: 1.25em;
  height: 1.25em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bl-icon--sm {
  width: 1em;
  height: 1em;
}

.bl-icon--lg {
  width: 1.5rem;
  height: 1.5rem;
}

/* A check mark drawn with borders, so terminals do not depend on a glyph. */
.bl-check {
  display: inline-block;
  width: 0.38em;
  height: 0.72em;
  margin: 0 0.55em 0.08em 0.2em;
  border: solid currentColor;
  border-width: 0 0.14em 0.14em 0;
  color: var(--bl-ok);
  transform: rotate(40deg);
}

/* ── Brand: the mark and the wordmark, side by side ─────────────────────── */
/*
 *   <a class="bl-brand" href="/"><img class="bl-brand__mark" src="logo/mark.svg" alt="">
 *     <img class="bl-brand__word" src="logo/wordmark.svg" alt="Bodylet AI"></a>
 *
 * Two files on purpose: every page takes the mark from logo/mark.svg alone.
 */

.bl-brand {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.34em;
  border-radius: var(--bl-radius-sm);
  font-size: 1.625rem;         /* the height of the mark; the word follows */
}

.bl-brand:hover {
  text-decoration: none;
}

.bl-brand__mark {
  width: 1em;
  height: 1em;
}

.bl-brand__word {
  width: auto;
  height: 0.68em;
  margin-top: 0.04em;
}

/* ── Layout primitives ──────────────────────────────────────────────────── */

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

.bl-stack {
  display: flex;
  flex-direction: column;
  gap: var(--bl-stack-gap, var(--bl-space-4));
}

.bl-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--bl-row-gap, var(--bl-space-3));
}

.bl-row--between {
  justify-content: space-between;
}

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

.bl-divider {
  height: 1px;
  background: var(--bl-border);
}

.bl-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.bl-skip {
  position: absolute;
  top: var(--bl-space-3);
  left: var(--bl-space-3);
  z-index: var(--bl-z-toast);
  padding: 0.6rem 1rem;
  border-radius: var(--bl-radius-md);
  background: var(--bl-accent-fill);
  color: var(--bl-text-on-accent);
  font-weight: var(--bl-weight-semibold);
  transform: translateY(-200%);
}

.bl-skip:focus {
  color: var(--bl-text-on-accent);
  transform: none;
}

/* A column of product windows on the page ground: documentation, previews. */
.bl-board {
  --bl-container: 65rem;
  display: flex;
  flex-direction: column;
  gap: var(--bl-space-6);
  padding-block: var(--bl-space-8);
}

/* On the board the code is the subject: it is set one step larger. */
.bl-board .bl-term,
.bl-board .bl-code {
  font-size: 0.9375rem;
}

.bl-board .bl-code {
  line-height: 1.95;
}

/* A custom scrollbar for scrolling panels inside the UI. */
.bl-scroll {
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--bl-surface-4) transparent;
}
