/*
 * BookPoint design system — scoped base.
 * Neutralises common theme rules (button/input/heading/link styles) inside
 * .bp-ui only. Uses :where() so component classes always win without
 * specificity wars, and logical properties so RTL works automatically.
 */

.bp-ui {
  font-family: var(--bp-font);
  font-size: var(--bp-fs-md);
  line-height: var(--bp-lh-normal);
  color: var(--bp-c-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: start;
  letter-spacing: normal;
  text-transform: none;
}

.bp-ui :where(*, *::before, *::after) {
  box-sizing: border-box;
}

.bp-ui :where(h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, ul, ol) {
  margin: 0;
  padding: 0;
}

.bp-ui :where(ul, ol) {
  list-style: none;
}

.bp-ui :where(h1, h2, h3, h4, h5, h6) {
  font-family: inherit;
  color: inherit;
  font-weight: var(--bp-fw-semibold);
  line-height: var(--bp-lh-tight);
  letter-spacing: -0.01em;
  text-transform: none;
}

.bp-ui :where(button, input, select, textarea) {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-transform: none;
  margin: 0;
}

.bp-ui :where(button) {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  box-shadow: none;
  text-shadow: none;
  border-radius: 0;
  min-height: 0;
  line-height: inherit;
}

.bp-ui :where(button:disabled) {
  cursor: not-allowed;
}

.bp-ui :where(a) {
  color: var(--bp-c-link);
  text-decoration: underline;
  text-underline-offset: 2px;
  box-shadow: none;
}

.bp-ui :where(img, svg, video) {
  display: block;
  max-width: 100%;
}

.bp-ui :where(img) {
  height: auto;
}

.bp-ui :where(svg) {
  flex-shrink: 0;
}

.bp-ui :where(table) {
  border-collapse: collapse;
  border-spacing: 0;
  margin: 0;
  width: 100%;
}

.bp-ui :where(th, td) {
  border: 0;
  padding: 0;
  text-align: start;
}

.bp-ui :where(hr) {
  border: 0;
  border-top: 1px solid var(--bp-c-border);
  margin: var(--bp-s-4) 0;
}

.bp-ui :where([hidden]) {
  display: none !important;
}

/* Visible, consistent keyboard focus everywhere (mouse clicks don't show it). */
.bp-ui :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--bp-focus-color);
  outline-offset: 2px;
}

.bp-ui :where(a, button, input, select, textarea, [tabindex]):focus:not(:focus-visible) {
  outline: none;
}

/* Mirror directional icons in right-to-left layouts. */
.bp-ui[dir="rtl"] .bp-icon--dir,
[dir="rtl"] .bp-ui .bp-icon--dir { transform: scaleX(-1); }

/* Keep LTR fragments (times, prices, emails) intact inside RTL text. */
.bp-ui .bp-ltr { direction: ltr; unicode-bidi: isolate; }

/* ---- Text helpers ---- */
.bp-ui .bp-text-muted { color: var(--bp-c-text-2); }
.bp-ui .bp-text-subtle { color: var(--bp-c-text-3); }
.bp-ui .bp-text-sm { font-size: var(--bp-fs-sm); }
.bp-ui .bp-text-xs { font-size: var(--bp-fs-xs); }
.bp-ui .bp-text-lg { font-size: var(--bp-fs-lg); }
.bp-ui .bp-text-strong { font-weight: var(--bp-fw-semibold); }
.bp-ui .bp-text-danger { color: var(--bp-c-danger); }
.bp-ui .bp-text-success { color: var(--bp-c-success); }
.bp-ui .bp-tabular { font-variant-numeric: tabular-nums; }
.bp-ui .bp-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.bp-ui .bp-h1 { font-size: var(--bp-fs-2xl); font-weight: var(--bp-fw-bold); line-height: var(--bp-lh-tight); }
.bp-ui .bp-h2 { font-size: var(--bp-fs-xl); font-weight: var(--bp-fw-semibold); line-height: var(--bp-lh-tight); }
.bp-ui .bp-h3 { font-size: var(--bp-fs-lg); font-weight: var(--bp-fw-semibold); line-height: var(--bp-lh-snug); }
.bp-ui .bp-h4 { font-size: var(--bp-fs-base); font-weight: var(--bp-fw-semibold); line-height: var(--bp-lh-snug); }
.bp-ui .bp-eyebrow {
  font-size: var(--bp-fs-xs);
  font-weight: var(--bp-fw-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bp-c-text-3);
}

/* ---- Layout helpers ---- */
.bp-ui .bp-stack { display: flex; flex-direction: column; gap: var(--bp-gap, var(--bp-s-4)); }
.bp-ui .bp-cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--bp-gap, var(--bp-s-2)); }
.bp-ui .bp-spacer { flex: 1 1 auto; }
.bp-ui .bp-grid { display: grid; gap: var(--bp-gap, var(--bp-s-4)); grid-template-columns: repeat(auto-fill, minmax(var(--bp-grid-min, 220px), 1fr)); }

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

/* Skip-link style focus reveal */
.bp-ui .bp-visually-hidden-focusable:not(:focus):not(:focus-within) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
}

@media (prefers-reduced-motion: reduce) {
  .bp-ui *,
  .bp-ui *::before,
  .bp-ui *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
