/* ═══════════════════════════════════════════════════════════════════════════
   PHYSICSFORUM.ORG — BASE STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

body {
  background: var(--color-photon-white);
  font-family: var(--font-display);
  color: var(--color-dark-grey);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s, color 0.3s;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
  font-family: var(--font-body);
  line-height: 1.75;
}

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

/* Optional readability cap — apply ONLY on containers that opt-in.
   Fixes v4.6.0 bug where every <p> was capped at 68ch, making posts
   look left-aligned with empty space on the right. */
.prose-narrow p,
.prose-narrow li { max-width: 68ch; }

a {
  color: var(--color-electric);
  transition: var(--transition-fast);
}
a:hover {
  text-decoration: underline;
}
a:visited {
  color: var(--color-soft-purple);
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: rgba(15,23,42,0.06);
  color: var(--color-electric);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
}
[data-theme="dark"] code {
  background: rgba(255,255,255,0.08);
}

pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  background: var(--color-code-bg);
  color: var(--color-photon-white);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  line-height: 1.7;
  tab-size: 2;
}
pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

blockquote {
  border-left: 4px solid var(--color-quantum-gold);
  padding: var(--space-4) var(--space-6);
  margin: var(--space-6) 0;
  font-style: italic;
  background: rgba(148,163,184,0.08);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
blockquote p {
  max-width: none;
}

table {
  width: 100%;
  border-collapse: collapse;
}
thead th {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-bottom: 2px solid var(--color-neutron-grey);
  color: var(--color-dark-grey);
  position: sticky;
  top: 0;
  background: var(--color-photon-white);
  z-index: var(--z-above);
}
tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid rgba(148,163,184,0.2);
}
tbody tr:nth-child(even) {
  background: rgba(148,163,184,0.04);
}
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

hr {
  height: 1px;
  background: var(--color-neutron-grey);
  opacity: 0.5;
  margin: var(--space-8) 0;
}

img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
}
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s ease;
}
img[loading="lazy"].loaded {
  opacity: 1;
}

::selection {
  background: var(--color-electric);
  color: #fff;
}

::placeholder {
  color: var(--color-neutron-grey);
  opacity: 0.7;
}

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

.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;
}
.skip-to-main {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--color-electric);
  color: #fff;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  z-index: var(--z-tooltip);
  font-weight: 600;
  transition: top 0.2s;
}
.skip-to-main:focus {
  top: var(--space-4);
}

/* ── KaTeX stretchy-SVG protection (v4.7) ────────────────────────────────
   reset.css's responsive-media rule (`img, svg … { display:block;
   max-width:100%; height:auto }`) collides with how KaTeX draws ACCENTS
   (\vec, \hat, \widehat, \overrightarrow, \bar) — those are positioned,
   width-100% SVGs inside .katex, and the reset collapsed/resized them
   (invisible arrows; "\vec{a}" looked like plain "a").
   This scoped override restores exactly the values KaTeX intends, with
   enough specificity to beat the element-level reset no matter the
   stylesheet load order. */
.katex svg {
  display: block;
  position: absolute;
  width: 100%;
  height: inherit;
  max-width: none;
  max-height: none;
  min-width: 0;
  min-height: 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   ACCESSIBILITY — REDUCED MOTION (v4.9)

   The site has orbiting auth backgrounds, scroll-reveal animations, hover
   lifts and running simulations. For users with vestibular disorders that
   range is genuinely unpleasant, and honouring this preference is a
   baseline expectation for an accessibility-ready theme.

   Note the deliberate exception: canvas simulations in PhysicsLab are the
   POINT of the page, so they keep running. Only decorative motion stops.
   ══════════════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  /* Decorative background motion — off entirely. */
  .auth-orb,
  .hero-particle,
  .floating-formula {
    animation: none !important;
    transform: none !important;
  }

  /* Scroll-reveal elements must not stay invisible if their animation
     never runs — force the finished state. */
  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }

  /* Hover lifts flatten out. */
  .card-hover:hover,
  .search-result-card:hover,
  .fellow-card:hover {
    transform: none !important;
  }
}

/* Keyboard focus must always be visible — never remove without replacing. */
:focus-visible {
  outline: 3px solid var(--color-electric);
  outline-offset: 2px;
  border-radius: 2px;
}
