/* =============================================================
   Society of Scholar Writers — Base Styles (base.css)
   ============================================================= */

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

html {
  font-size: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
}

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ── Skip Link ──────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  z-index: var(--z-toast);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-4);
}

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

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-base); font-family: var(--font-body); font-weight: var(--weight-semibold); }
h5 { font-size: var(--text-sm);   font-family: var(--font-body); font-weight: var(--weight-semibold); }
h6 { font-size: var(--text-xs);   font-family: var(--font-body); font-weight: var(--weight-semibold); }

p {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--color-text-muted);
  max-width: 68ch;
}

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

a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

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

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

strong, b { font-weight: var(--weight-semibold); color: var(--color-text); }
em, i { font-style: italic; }

small {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ── Lists ───────────────────────────────────────────────────── */
ul, ol {
  padding-left: var(--space-6);
  color: var(--color-text-muted);
  line-height: var(--leading-relaxed);
}

li { margin-top: var(--space-2); }
li:first-child { margin-top: 0; }

ul.list-none,
ol.list-none {
  list-style: none;
  padding-left: 0;
}

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

img { object-fit: cover; }

/* ── Forms baseline ─────────────────────────────────────────── */
button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

button { cursor: pointer; }

/* ── HR ─────────────────────────────────────────────────────── */
hr {
  border: none;
  border-top: 1px solid var(--color-divider);
  margin: var(--space-8) 0;
}

/* ── Blockquote ─────────────────────────────────────────────── */
blockquote {
  border-left: 3px solid var(--color-accent);
  padding: var(--space-4) var(--space-6);
  background: var(--color-accent-light);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--color-text-muted);
  margin: var(--space-6) 0;
}

/* ── Code ────────────────────────────────────────────────────── */
code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.9em;
  background: var(--color-surface-2);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  color: var(--color-primary);
}

/* ── Focus styles ────────────────────────────────────────────── */
:focus { outline: none; }

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

/* ── Selection ───────────────────────────────────────────────── */
::selection {
  background: var(--color-accent);
  color: var(--color-navy);
}

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--color-surface-2); }
::-webkit-scrollbar-thumb {
  background: var(--color-text-faint);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

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

.text-center  { text-align: center; }
.text-left    { text-align: left; }
.text-right   { text-align: right; }

.color-primary { color: var(--color-primary); }
.color-accent  { color: var(--color-accent); }
.color-muted   { color: var(--color-text-muted); }

.font-display { font-family: var(--font-display); }
.font-body    { font-family: var(--font-body); }
