/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,200..800;1,6..72,200..800&display=swap');

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Theme variables: Light mode (default) */
:root, html.light-mode {
  --bg: #ffffff;
  --text: #000000;
  --heading: #1a1a1a;
  --link: #007700;
  --link-hover: #1741a6;
  --muted: #888;
  --code-bg: rgba(135, 131, 120, 0.15);
  --code-text: #eb5757;
  --blockquote: #37352f;
  --table-th-bg: #f4f4f4;
  --table-tr-even-bg: #f9f9f9;
  --table-tr-hover-bg: #f1f1f1;
  --pre-bg: #f4f4f4;
  --pre-shadow: 0 2px 8px 0 rgba(60,60,60,0.04);
  --subtitle: #333;
}

/* Dark mode overrides */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1e1e1e;
    --text: #f1f1f1;
    --heading: #f1f1f1;
    --link: #00ff00;
    --link-hover: #00ff88;
    --muted: #aaaaaa;
    --code-bg: #232323;
    --code-text: #00ff00;
    --blockquote: #00ff00;
    --table-th-bg: #232323;
    --table-tr-even-bg: #232323;
    --table-tr-hover-bg: #222822;
    --pre-bg: #232323;
    --pre-shadow: 0 2px 8px 0 rgba(0,255,0,0.04);
    --subtitle: #aaaaaa;
  }
}

/* Explicit Dark Mode */
html.dark-mode {
    --bg: #1e1e1e;
    --text: #f1f1f1;
    --heading: #f1f1f1;
    --link: #00ff00;
    --link-hover: #00ff88;
    --muted: #aaaaaa;
    --code-bg: #232323;
    --code-text: #00ff00;
    --blockquote: #00ff00;
    --table-th-bg: #232323;
    --table-tr-even-bg: #232323;
    --table-tr-hover-bg: #222822;
    --pre-bg: #232323;
    --pre-shadow: 0 2px 8px 0 rgba(0,255,0,0.04);
    --subtitle: #aaaaaa;
}

body {
    font-family: 'Newsreader', 'Times New Roman', Times, serif;
    font-size: 1.1em;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.8;
    letter-spacing: 0.03em;
    word-spacing: 0.10em;
    position: relative;
}

main {
    max-width: 900px;
    margin: 40px auto;
    background-color: var(--bg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1), 0 1px 8px rgba(0, 0, 0, 0.06);
    padding: 40px;
    z-index: 1;
    position: relative;
}

h1, h2, h3, .page-title {
    color: var(--heading);
}

h1 {
    font-size: 2.5em;
    margin-bottom: 0.3em;
}

p {
    margin-bottom: 1.0em;
}

a, a:visited {
    color: var(--link);
    text-decoration: none;
}

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

u {
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.2em;
  text-decoration-color: var(--link);
}

.subtitle {
    color: var(--subtitle);
}

table {
    width: 100%;
    max-width: 800px;
    margin: 20px auto;
    border-collapse: collapse;
    font-size: 16px;
    background: var(--bg);
    color: var(--text);
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    background: none;
    color: var(--text);
}

th {
    background-color: var(--table-th-bg, #f4f4f4);
    font-weight: bold;
    color: var(--text);
}

tr:nth-child(even) {
    background-color: var(--table-tr-even-bg, #f9f9f9);
}

tr:hover {
    background-color: var(--table-tr-hover-bg, #f1f1f1);
}

code, .code {
    background-color: var(--code-bg);
    color: var(--code-text);
    font-family: 'Courier New', Courier, monospace;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9em;
    letter-spacing: 0.03em;
}

td code, th code {
    background-color: #f4f4f4;
    padding: 2px 4px;
}

pre {
    background-color: var(--pre-bg);
    box-shadow: var(--pre-shadow);
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
    margin: 10px 0;
}

pre code {
    background-color: transparent;
    padding: 0;
    font-family: 'Courier New', Courier, monospace;
}

em {
    font-style: italic;
    color: var(--subtitle);
}

td em, th em {
    font-style: italic;
}

.image-caption {
    max-width: 600px;
    margin: 20px auto;
    text-align: center;
}

.image-caption img {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.image-caption figcaption, figcaption, time, .pdf-relative-link-path, .page-description {
    margin-top: 8px;
    font-size: 0.9em;
    color: var(--muted);
    font-style: italic;
}

.til-link {
  display: block;
  font-size: 1.5em;
  margin-top: 0.1em;
  margin-bottom: 0.1em;
  color: var(--til-link);
  text-decoration: none;
}

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

blockquote {
  border-left: 3px solid var(--blockquote);
  color: var(--text);
  padding-left: 1em;
  margin-left: 1em;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('/raster.svg');
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center center;
    z-index: -2;
}

mark {
    background-color: #ffe100;
    color: black;
}