/* styles.css
   Boring academic paper look, inspired by latex.css (latex.vercel.app).
   Last modified: 2026-09-27
   By: Enrique Lopez
*/

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --fg: #1a1a1a;
  --bg: #fafafa;
  --muted: #555;
  --rule: #222;
  --link: #4b3cb8;
  --link-visited: #6b4aa8;
  --code-bg: #eee;
  --pre-bg: #f0f0f0;
  --focus: #5b4fd4;
  --indent: 1.5em;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e6e6e6;
    --bg: #1c1c1c;
    --muted: #aaa;
    --rule: #ccc;
    --link: #a99cf0;
    --link-visited: #c4b5e8;
    --code-bg: #2a2a2a;
    --pre-bg: #262626;
    --focus: #c4b8ff;
  }
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  overflow-y: scroll;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
  max-width: 40rem; /* ~80ch at 16px serif */
  min-height: 100vh;
  color: var(--fg);
  background: var(--bg);
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 1rem;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  hyphens: auto;
}

body.latex-dark {
  max-width: 85ch;
  --fg: #e6e6e6;
  --bg: #1c1c1c;
  --muted: #aaa;
  --rule: #ccc;
  --link: #a99cf0;
  --link-visited: #c4b5e8;
  --code-bg: #2a2a2a;
  --pre-bg: #262626;
  --focus: #c4b8ff;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: Georgia, "Times New Roman", Times, serif;
  font-weight: 700;
  line-height: 1.25;
  margin: 1.75em 0 0.5em;
  hyphens: none;
}

h1 {
  font-size: 1rem;
  font-weight: 900;
  margin-top: 0.5em;
}

/*
h1:first-child {
  margin-top: 0;
}
*/

h2, h3, h4, h5, h6 {
  font-size: 0.95rem;
  font-weight: 700;
}

p {
  margin: 0.85em 0;
}

/* Optional LaTeX-style first-line indent on following paragraphs */
.indent p + p {
  text-indent: var(--indent);
}

.indent h1 + p,
.indent h2 + p,
.indent h3 + p,
.indent h4 + p,
.indent blockquote + p,
.indent pre + p,
.indent ul + p,
.indent ol + p {
  text-indent: 0;
}

.no-indent {
  text-indent: 0 !important;
}

.justify {
  text-align: justify;
}

a {
  color: var(--link);
  text-underline-offset: 0.12em;
}

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

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

ul,
ol {
  margin: 0.85em 0;
  padding-left: 1.6em;
}

li {
  margin: 0.2em 0;
}

li > ul,
li > ol {
  margin: 0.2em 0;
}

blockquote {
  margin: 1em 0 1em 1.5em;
  padding: 0;
  color: var(--muted);
  font-style: italic;
  border: none;
}

hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2em 0;
}

img,
video,
svg {
  max-width: 100%;
  height: auto;
}

figure {
  margin: 1.5em 0;
}

figcaption {
  margin-top: 0.4em;
  font-size: 0.9em;
  color: var(--muted);
}

code,
kbd,
samp,
pre {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.88em;
  hyphens: none;
}

code {
  background: var(--code-bg);
  padding: 0.1em 0.3em;
}

pre {
  background: var(--pre-bg);
  padding: 0.9em 1.1em;
  overflow-x: auto;
  line-height: 1.45;
}

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

kbd {
  background: var(--code-bg);
  border: 1px solid var(--muted);
  border-radius: 2px;
  padding: 0.05em 0.3em;
  font-size: 0.8em;
}

table {
  border-collapse: collapse;
  width: auto;
  max-width: 100%;
  margin: 1.25em 0;
  border-top: 2px solid var(--rule);
  border-bottom: 2px solid var(--rule);
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.4em 0.7em;
  line-height: 1.35;
}

thead th {
  border-bottom: 1px solid var(--rule);
  font-weight: 700;
}

caption {
  caption-side: top;
  text-align: left;
  font-size: 0.9em;
  margin-bottom: 0.4em;
}

.author,
.subtitle {
  text-align: center;
  color: var(--muted);
  margin: 0.25em 0 1.5em;
}

.abstract {
  margin: 1.5em 2em;
  font-size: 0.95em;
}

.abstract > h2,
.abstract > .title {
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.5em;
}

nav ol {
  padding-left: 1.4em;
}

input,
button,
textarea,
select {
  font: inherit;
}

textarea {
  width: 100%;
}

.img-gallery {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    align-items: start;
}

.img-gallery img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

@media (max-width: 700px) {
    .img-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 450px) {
    .img-gallery {
    grid-template-columns: 1fr;
    }
}


@media print {
  body {
    max-width: none;
    padding: 0;
    background: #fff;
    color: #000;
  }

  a {
    color: inherit;
    text-decoration: underline;
  }

  pre,
  blockquote {
    page-break-inside: avoid;
  }
}