/**
 * Base Styles and Reset
 * Academic Website Modernization
 */

/* Box Sizing Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Root and Body */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-background);
}

/* Typography Base */
h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  margin-bottom: var(--spacing-4);
  font-family: var(--font-heading);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-heading);
  color: var(--color-text);
}

h1 {
  font-size: var(--font-size-h1);
}

h2 {
  font-size: var(--font-size-h2);
}

h3 {
  font-size: var(--font-size-h3);
}

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

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

h6 {
  font-size: var(--font-size-h6);
}

/* Responsive Typography */
@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.75rem;
  }
  
  h3 {
    font-size: 1.5rem;
  }
}

/* Paragraphs */
p {
  margin-top: 0;
  margin-bottom: var(--spacing-4);
}

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

a:hover,
a:focus {
  color: var(--color-link-hover);
  text-decoration: underline;
}

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

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

/* Lists */
ul, ol {
  margin-top: 0;
  margin-bottom: var(--spacing-4);
  padding-left: var(--spacing-6);
}

li {
  margin-bottom: var(--spacing-2);
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Buttons */
button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

/* Focus Styles for Accessibility */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Remove default focus outline for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

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

/* Horizontal Rule */
hr {
  margin: var(--spacing-8) 0;
  border: 0;
  border-top: 1px solid var(--color-border);
}

/* Code */
code, pre {
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.875em;
}

code {
  padding: 0.125rem 0.25rem;
  background-color: var(--color-border);
  border-radius: var(--radius-sm);
}

pre {
  padding: var(--spacing-4);
  background-color: var(--color-border);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

pre code {
  padding: 0;
  background-color: transparent;
}

/* Blockquote */
blockquote {
  margin: var(--spacing-6) 0;
  padding-left: var(--spacing-6);
  border-left: 4px solid var(--color-accent);
  font-style: italic;
  color: var(--color-text-light);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--spacing-6);
}

th, td {
  padding: var(--spacing-3) var(--spacing-4);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

th {
  font-weight: var(--font-weight-semibold);
  background-color: var(--color-background);
}

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