/* ============================================================
   Base / Reset — BG Genius Player
   ============================================================ */

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100dvh;
  overflow: hidden;
}

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

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

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: opacity var(--transition-fast);
}

a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---- Typography ---- */

h1, h2, h3, h4, h5, h6 {
  line-height: var(--leading-tight);
  font-weight: 600;
  color: var(--text-primary);
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl);  }
h3 { font-size: var(--text-lg);  }
h4 { font-size: var(--text-md);  }

/* ---- Theme-aware logos ---- */

/* Dark theme (default): show dark variant, hide light */
.theme-logo--light { display: none; }
.theme-logo--dark  { display: block; }

/* Light theme via OS preference */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-logo--light { display: block; }
  :root:not([data-theme="dark"]) .theme-logo--dark  { display: none; }
}

/* Light theme via manual toggle */
:root[data-theme="light"] .theme-logo--light { display: block; }
:root[data-theme="light"] .theme-logo--dark  { display: none; }

/* ---- Step titles ---- */

.step__layer-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-xs);
}

.step__title {
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-lg);
  position: relative;
}

.step__title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 2.5rem;
  height: 2px;
  background: var(--color-accent);
  border-radius: 1px;
}

p {
  margin-bottom: var(--space-md);
}

p:last-child {
  margin-bottom: 0;
}

strong {
  font-weight: 600;
}

em {
  font-style: italic;
}

/* ---- Lists ---- */

ul, ol {
  padding-left: var(--space-lg);
  margin-bottom: var(--space-md);
}

li {
  margin-bottom: var(--space-xs);
}

li:last-child {
  margin-bottom: 0;
}

/* ---- Selection ---- */

::selection {
  background-color: var(--color-accent);
  color: var(--bg-primary);
}

/* ---- Scrollbar ---- */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: var(--text-muted);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--text-secondary);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--text-muted) transparent;
}

/* ---- Focus styles ---- */

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

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ---- Utility: visually hidden ---- */

.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;
}

/* ---- Markdown tables ---- */

.md-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--space-md, 1rem) 0;
  border-radius: var(--radius-md, 8px);
  border: 1px solid var(--surface-emphasis);
}

.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm, 0.875rem);
  line-height: 1.5;
}

.md-table th {
  text-align: left;
  padding: var(--space-sm, 0.5rem) var(--space-md, 1rem);
  background-color: var(--surface-hover);
  color: var(--text-primary, #e8e8e8);
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-emphasis);
}

.md-table td {
  padding: var(--space-sm, 0.5rem) var(--space-md, 1rem);
  color: var(--text-secondary, #a0a0b8);
  border-bottom: 1px solid var(--border-subtle);
}

.md-table tbody tr:last-child td {
  border-bottom: none;
}

.md-table tbody tr:hover {
  background-color: var(--surface-hover);
}
