/* 0. Fonts */
@font-face {
  font-family: "Latin Modern Roman";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/lmroman10-regular.woff2") format("woff2");
}
@font-face {
  font-family: "Latin Modern Roman";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/lmroman10-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Latin Modern Roman";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/lmroman10-bold.woff2") format("woff2");
}
@font-face {
  font-family: "Latin Modern Roman";
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/lmroman10-bolditalic.woff2") format("woff2");
}

/* 1. Colours */
:root {
  --bg: #ffffff;
  --fg: #000000;
  --muted: #444444;
  --link: #0000ee;
  --visited: #551a8b;
  --rule: #000000;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #000000;
  --fg: #dcdcdc;
  --muted: #a8a8a8;
  --link: #6ea8ff;
  --visited: #b991ff;
  --rule: #666666;
  color-scheme: dark;
}

/* 2. Page */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 19px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  padding: 0 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: "Latin Modern Roman", "Computer Modern", "Times New Roman", Times, serif;
  line-height: 1.45;
}
[data-theme="dark"] body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
[data-theme="dark"] .prose { -webkit-text-stroke: 0.2px currentColor; }
.site-header-inner, .site-main, .site-footer-inner { width: 100%; max-width: 780px; margin: 0 auto; }
.site-main { flex: 1 0 auto; padding-top: 1.5rem; padding-bottom: 2rem; }
.site-main:focus { outline: none; }
a { color: var(--link); }
a:visited { color: var(--visited); }
hr { border: 0; border-top: 1px solid var(--rule); margin: 1.5rem 0; }
img { max-width: 100%; height: auto; }
.skip-link { position: absolute; left: 0.5rem; top: -4rem; padding: 0.3rem 0.6rem; background: var(--bg); }
.skip-link:focus { top: 0.5rem; }

/* Visually hidden, still read by screen readers */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* 3. Header and footer */
.site-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  padding-top: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
}
.site-title { margin-right: auto; font-size: 1.15rem; font-weight: bold; color: var(--fg); text-decoration: none; }
.site-title:visited { color: var(--fg); }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 1rem; }
.site-nav a[aria-current="page"] { color: var(--fg); text-decoration: none; }
.theme-toggle { align-self: center; padding: 0; border: 0; background: none; color: var(--link); cursor: pointer; }
.theme-toggle .icon { display: block; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding-top: 0.6rem;
  padding-bottom: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
}
.site-footer p { margin: 0; }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; gap: 1rem; }

/* 4. Text, set like an APS paper */
p { margin: 0; text-align: justify; hyphens: auto; }
p + p { text-indent: 1.5em; }
h1, h2, h3, h4 { font-weight: bold; line-height: 1.25; }
h1 { font-size: 1.45rem; text-align: center; margin: 0.5rem 0 1.2rem; }
.article-summary { margin: -0.6rem 0 1.2rem; text-align: center; font-style: italic; }
.prose { counter-reset: section; }
.prose h2 { counter-increment: section; counter-reset: subsection; margin: 1.6rem 0 0.7rem; font-size: 1rem; text-align: center; text-transform: uppercase; }
.prose h2::before { content: counter(section, upper-roman) ".\00a0"; }
.prose h3 { counter-increment: subsection; margin: 1.2rem 0 0.5rem; font-size: 1rem; text-align: center; }
.prose h3::before { content: counter(subsection, upper-alpha) ".\00a0"; }
.prose h4 { margin: 1rem 0 0.4rem; font-size: 1rem; font-weight: normal; font-style: italic; }
.prose a.headerlink { margin-left: 0.3em; text-decoration: none; opacity: 0; color: var(--muted); }
.prose h2:hover a.headerlink, .prose h3:hover a.headerlink, .prose a.headerlink:focus-visible { opacity: 1; }
ul, ol { margin: 0.6rem 0; padding-left: 1.5em; }
li { margin: 0.2rem 0; }
blockquote { margin: 1rem 1.5em; }
code, pre { font-family: "DejaVu Sans Mono", ui-monospace, monospace; font-size: 0.85em; }
pre { margin: 1rem 0 1rem 1.5em; overflow-x: auto; }
table { margin: 1rem auto; border-collapse: collapse; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
thead th { border-bottom: 1px solid var(--rule); }
th, td { padding: 0.25rem 0.8rem; text-align: left; }
figure { margin: 1rem 0; text-align: center; }
figcaption { font-size: 0.9em; }
.footnote { margin-top: 2rem; font-size: 0.88em; }
.footnote p { text-indent: 0; }

/* 5. Research page: two columns, publications numbered like references */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 2rem; }
.cols > div > h2:first-child { margin-top: 0.4rem; }
.pubs ol { list-style: none; padding-left: 2.2em; counter-reset: ref; }
.pubs li { position: relative; margin-bottom: 0.5rem; counter-increment: ref; }
.pubs li::before { content: "[" counter(ref) "]"; position: absolute; left: -2.2em; }
.pubs time { white-space: nowrap; }

/* 6. Small screens */
@media (max-width: 640px) {
  html { font-size: 17px; }
  .cols { grid-template-columns: 1fr; }
}

/* 7. Print */
@media print {
  html[data-theme="dark"] { --bg: #fff; --fg: #000; --muted: #444; --link: #000; --visited: #000; --rule: #000; color-scheme: light; }
  [data-theme="dark"] body { -webkit-font-smoothing: auto; -moz-osx-font-smoothing: auto; }
  [data-theme="dark"] .prose { -webkit-text-stroke: 0; }
  .site-header, .site-footer, .skip-link { display: none !important; }
  a.headerlink { display: none; }
}
