/*
 * Base Styles — Micrometry Automator
 * Typography, links, buttons, and core element styles.
 */

/* ─── Body ─── */
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-primary);
}

/* ─── Headings ─── */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--color-text);
  letter-spacing: -0.02em;
}

h1 {
  font-size: var(--text-5xl);
  font-weight: var(--weight-extrabold);
}

h2 {
  font-size: var(--text-4xl);
}

h3 {
  font-size: var(--text-2xl);
}

h4 {
  font-size: var(--text-xl);
}

h5 {
  font-size: var(--text-lg);
}

h6 {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
}

/* Responsive heading sizes */
@media (max-width: 1023px) {
  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }
  h3 { font-size: var(--text-xl); }
}

@media (max-width: 639px) {
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
  h3 { font-size: var(--text-xl); }
}

/* ─── Paragraphs ─── */
p {
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
  max-width: 72ch;
}

p + p {
  margin-top: var(--space-4);
}

/* ─── Links ─── */
a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-text);
}

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

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-base);
  white-space: nowrap;
}

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

/* Primary CTA button */
.btn-primary {
  background: var(--gradient-cta);
  color: var(--color-primary);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.btn-primary:hover {
  background: var(--gradient-cta-hover);
  box-shadow: var(--shadow-lg), var(--shadow-glow-strong);
  transform: translateY(-2px);
  color: var(--color-primary);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Secondary / outline button */
.btn-secondary {
  background: transparent;
  color: var(--color-accent);
  border: 1.5px solid var(--color-accent);
}

.btn-secondary:hover {
  background: var(--color-accent-dim);
  color: var(--color-text);
  border-color: var(--color-text);
}

/* Large button variant */
.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
  border-radius: var(--radius-xl);
}

/* ─── Code / Mono ─── */
code, pre, .mono {
  font-family: var(--font-mono);
}

code {
  font-size: 0.9em;
  padding: 0.15em 0.4em;
  background: var(--color-surface-light);
  border-radius: var(--radius-sm);
  color: var(--color-accent);
}

/* ─── Horizontal Rule ─── */
hr {
  border: none;
  height: 1px;
  background: var(--color-surface-border);
  margin: var(--space-12) 0;
}

/* ─── Selection ─── */
::selection {
  background: rgba(0, 212, 255, 0.3);
  color: var(--color-text);
}

/* ─── Scrollbar (Webkit) ─── */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--color-surface-light);
  border-radius: var(--radius-full);
}

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

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