/**
 * shared.css — Common design tokens, reset, fonts, and markdown styles
 * shared by the main site (css/style.css) and wiki (wiki/css/style.css).
 */

/* ===== Local Fonts ===== */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Crimson Pro';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/crimson-pro-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Crimson Pro';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/crimson-pro-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('../fonts/jetbrains-mono-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('../fonts/jetbrains-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

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

/* ===== Shared Design Tokens ===== */
:root {
  --color-bg: #fafafa;
  --color-surface: #ffffff;
  --color-text: #2c2c2c;
  --color-text-secondary: #5a5a5a;
  --color-text-muted: #888;
  --color-text-light: #999;
  --color-primary: #2a6496;
  --color-accent: #2a6496;
  --color-accent-hover: #1d4d73;
  --color-border: #e4e4e4;
  --color-border-light: #f0f0f0;
  --color-tag-bg: #eef3f8;
  --color-tag-text: #2a6496;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Crimson Pro", "Georgia", serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Fira Code", monospace;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
  --radius: 8px;
  --transition: 0.25s ease;
}

/* ===== Heading Anchors ===== */
.heading-anchor {
  position: relative;
  cursor: default;
}

.heading-anchor:hover::before {
  content: "#";
  position: absolute;
  left: -1.2em;
  color: var(--color-text-muted);
  font-weight: 400;
  opacity: 0.5;
}

/* ===== Math Error ===== */
pre.math-error {
  background: #fff0f0;
  border: 1px solid #ffc0c0;
  border-radius: var(--radius);
  padding: 12px 16px;
  color: #c00;
  font-size: 0.85rem;
}

/* ===== Shared Markdown Rendered Content (.md-content) ===== */
.md-content h1 {
  font-size: 1.65rem;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.35;
  color: var(--color-text);
}

.md-content h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 34px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}

.md-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 26px 0 8px;
  color: var(--color-text);
}

.md-content h4 {
  font-size: 1rem;
  font-weight: 600;
  margin: 22px 0 6px;
  color: var(--color-text-secondary);
}

.md-content > *:first-child {
  margin-top: 0;
}

.md-content p {
  margin-bottom: 14px;
  font-size: 0.98rem;
  line-height: 1.8;
}

.md-content ul,
.md-content ol {
  margin: 8px 0 16px 24px;
  line-height: 1.8;
}

.md-content li {
  margin-bottom: 4px;
  font-size: 0.98rem;
}

.md-content li > ul,
.md-content li > ol {
  margin-top: 4px;
  margin-bottom: 4px;
}

.md-content pre {
  background: #f5f6f8;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 8px 0 16px;
  font-size: 0.85rem;
  line-height: 1.65;
}

.md-content code {
  font-family: var(--font-mono);
  font-size: 0.87em;
}

.md-content p code,
.md-content li code,
.md-content td code {
  background: #f0f1f3;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.85em;
  word-break: break-word;
}

.md-content blockquote {
  border-left: 3px solid var(--color-accent);
  padding: 12px 20px;
  margin: 16px 0;
  background: var(--color-border-light);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--color-text-secondary);
}

.md-content blockquote p {
  margin-bottom: 0;
}

.md-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 0.9rem;
  display: block;
  overflow-x: auto;
}

.md-content thead,
.md-content tbody {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.md-content th,
.md-content td {
  border: 1px solid var(--color-border);
  padding: 8px 14px;
  text-align: left;
}

.md-content th {
  background: #f5f6f8;
  font-weight: 600;
  white-space: nowrap;
}

.md-content tr:nth-child(even) {
  background: #fafbfc;
}

.md-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin: 8px 0;
  display: block;
}

.md-content p > img:only-child {
  margin: 20px auto;
}

.md-content hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 30px 0;
}

.md-content .katex-display {
  margin: 20px 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
}

.md-content .katex {
  font-size: 1.05em;
}
