/* MathPert base.css — modern reset + element defaults */

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

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

body, h1, h2, h3, h4, h5, h6, p, ul, ol, figure, blockquote {
  margin: 0;
  padding: 0;
}

ul, ol { list-style: none; }

body {
  font-family: var(--font-body);
  color: var(--color-ink);
  background: var(--color-surface);
  background-image: linear-gradient(rgba(28, 39, 66, 0.055) 1px, transparent 1px);
  background-size: 100% var(--line-gap);
  font-size: var(--text-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  position: relative;
}

/* red marking-pen margin line, full height, like a marked exam script */
body::before {
  content: "";
  position: fixed;
  top: 0; bottom: 0;
  left: clamp(14px, 5vw, 70px);
  width: 1.5px;
  background: rgba(201, 59, 34, 0.4);
  z-index: 1;
  pointer-events: none;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-weight: 500;
  color: var(--color-ink);
}

p { margin-block-end: var(--space-4); color: var(--color-ink); }
p:last-child { margin-block-end: 0; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: color var(--duration-fast) var(--ease-out);
}
a:hover { color: var(--color-brand-primary); }

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

button, input, select, textarea {
  font: inherit;
  color: inherit;
}
button { cursor: pointer; background: none; border: 0; padding: 0; }

table { border-collapse: collapse; width: 100%; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--color-brand-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 1000;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-pill);
  color: #fff;
  background: var(--color-brand-dark);
  text-decoration: none;
  font-weight: 600;
  transition: top var(--duration-fast) var(--ease-out);
}
.skip-link:focus,
.skip-link:focus-visible {
  top: var(--space-4);
}

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