/*
 * Academic Paper Typography
 * LaTeX-inspired styling for research paper aesthetic
 */

/* Computer Modern font (LaTeX standard) */
@import url('https://fonts.cdnfonts.com/css/latin-modern-roman');

:root {
  /* Academic color palette */
  --paper-bg: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #4a4a4a;
  --accent-blue: #003262;      /* Berkeley Blue */
  --accent-gold: #FDB515;      /* California Gold */
  --code-bg: #f5f5f5;
  --border-color: #d0d0d0;
  --link-color: #003262;
  --link-hover: #FDB515;

  /* Typography scale (LaTeX defaults) */
  --font-body: 'Latin Modern Roman', 'Computer Modern', Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
  --font-mono: 'Courier New', 'Lucida Console', monospace;

  /* Spacing (based on LaTeX article class) */
  --line-height: 1.6;
  --paragraph-spacing: 1.2em;
  --section-spacing: 2em;
  --subsection-spacing: 1.5em;
}

/* Base typography */
body {
  font-family: var(--font-body);
  font-size: 11pt;
  line-height: var(--line-height);
  color: var(--text-primary);
  background: var(--paper-bg);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Headings (LaTeX-style numbering) */
h1 {
  font-size: 1.75em;
  font-weight: bold;
  margin: var(--section-spacing) 0 1em 0;
  color: var(--accent-blue);
  line-height: 1.2;
}

h2 {
  font-size: 1.5em;
  font-weight: bold;
  margin: var(--section-spacing) 0 0.8em 0;
  color: var(--text-primary);
  line-height: 1.3;
}

h3 {
  font-size: 1.25em;
  font-weight: bold;
  margin: var(--subsection-spacing) 0 0.6em 0;
  color: var(--text-primary);
  line-height: 1.3;
}

h4 {
  font-size: 1.1em;
  font-weight: bold;
  margin: 1.2em 0 0.5em 0;
  color: var(--text-primary);
}

h5, h6 {
  font-size: 1em;
  font-weight: bold;
  margin: 1em 0 0.5em 0;
  color: var(--text-primary);
}

/* Paragraphs (LaTeX-style) */
p {
  margin: var(--paragraph-spacing) 0;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
}

/* Links */
a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

/* Lists */
ul, ol {
  margin: 1em 0;
  padding-left: 2em;
}

li {
  margin: 0.5em 0;
  line-height: var(--line-height);
}

/* Blockquotes (Abstract-style) */
blockquote {
  margin: 2em 3em;
  padding: 1em 1.5em;
  border-left: 4px solid var(--accent-blue);
  background: #f9f9f9;
  font-size: 0.95em;
  line-height: 1.5;
}

/* Code blocks */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  border: 1px solid #e0e0e0;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 1em;
  overflow-x: auto;
  margin: 1.5em 0;
  line-height: 1.4;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85em;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.95em;
}

th, td {
  border: 1px solid var(--border-color);
  padding: 0.6em 1em;
  text-align: left;
}

th {
  background: #f5f5f5;
  font-weight: bold;
  color: var(--text-primary);
}

tr:nth-child(even) {
  background: #fafafa;
}

/* Figures and captions */
figure {
  margin: 2em 0;
  text-align: center;
}

figure img {
  max-width: 100%;
  height: auto;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
}

figcaption {
  font-size: 0.9em;
  font-style: italic;
  color: var(--text-secondary);
  margin-top: 0.8em;
  line-height: 1.4;
}

/* Horizontal rules */
hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 2em 0;
}

/* Emphasis */
strong, b {
  font-weight: bold;
  color: var(--text-primary);
}

em, i {
  font-style: italic;
}

/* Subscript and superscript */
sub, sup {
  font-size: 0.75em;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sup {
  top: -0.5em;
}

sub {
  bottom: -0.25em;
}

/* Small text */
small {
  font-size: 0.85em;
  color: var(--text-secondary);
}

/* Section dividers */
.section-divider {
  margin: 3em 0;
  border-top: 2px solid var(--border-color);
}

/* Equation styling (for MathJax) */
.equation {
  margin: 1.5em 0;
  text-align: center;
  overflow-x: auto;
}

.equation-number {
  float: right;
  font-size: 0.9em;
  color: var(--text-secondary);
  margin-left: 1em;
}

/* Inline math */
.math-inline {
  font-style: italic;
}

/* Definition lists (for terminology) */
dl {
  margin: 1.5em 0;
}

dt {
  font-weight: bold;
  margin-top: 1em;
  color: var(--text-primary);
}

dd {
  margin-left: 2em;
  margin-top: 0.5em;
  color: var(--text-secondary);
}
