/* Research · Grupo Nogueira-Pires
   A classic blog: one serif column, white paper or black in dark mode. */

@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url('../fonts/source-serif-4-latin-wght-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Source Serif 4';
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url('../fonts/source-serif-4-latin-wght-italic.woff2') format('woff2');
}

:root {
  color-scheme: light;
  --paper: #fff;
  --ink: #1b1b1b;
  --ink-soft: #5e5e5e;
  --rule: #e3e3e3;
  --link: #1f47d1;
  --link-hover: #12308e;
  --button: #1b1b1b;
  --on-button: #fff;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --measure: 43rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #000;
    --ink: #e9e9e6;
    --ink-soft: #a6a6a1;
    --rule: #2b2b2b;
    --link: #93abff;
    --link-hover: #c3d0ff;
    --button: #e9e9e6;
    --on-button: #000;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.7;
  font-optical-sizing: auto;
  overflow-wrap: break-word;
}

.wrap {
  width: min(100% - 2rem, var(--measure));
  margin-inline: auto;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--link-hover);
  text-decoration-thickness: 2px;
}

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

main:focus {
  outline: none;
}

.nowrap {
  white-space: nowrap;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 0.75rem;
  left: 1rem;
  z-index: 1;
  padding: 0.5rem 0.9rem;
  background: var(--button);
  color: var(--on-button);
  transform: translateY(-200%);
}

.skip-link:focus {
  color: var(--on-button);
  transform: none;
}

/* Header */

.site-header {
  margin-bottom: 3.25rem;
  padding-top: 3.25rem;
  border-bottom: 1px solid var(--rule);
}

.site-title {
  margin: 0;
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.site-title a {
  color: var(--ink);
  text-decoration: none;
}

.site-description {
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  font-style: italic;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.6rem;
  margin: 1.6rem 0 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-block;
  margin-bottom: -1px;
  padding: 0.65rem 0;
  border-bottom: 2px solid transparent;
  color: var(--ink);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.site-nav a:hover,
.site-nav a[aria-current='page'] {
  border-bottom-color: var(--ink);
}

/* Posts */

.page-title {
  margin: 0 0 2.25rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.entry + .entry {
  margin-top: 2.75rem;
  padding-top: 2.75rem;
  border-top: 1px solid var(--rule);
}

.entry-kicker {
  margin: 0 0 0.5rem;
  color: var(--ink-soft);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.entry-title {
  margin: 0;
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.entry-title a {
  color: var(--ink);
  text-decoration: none;
}

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

.entry-single .entry-title {
  font-size: clamp(1.9rem, 1.3rem + 2.2vw, 2.6rem);
  line-height: 1.15;
}

.entry-meta {
  margin: 0.65rem 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-style: italic;
}

.entry-summary,
.entry-content {
  margin-top: 1.4rem;
}

.entry-summary p,
.entry-content p {
  margin: 0 0 1.1em;
  hyphens: auto;
}

.entry-content h2,
.entry-single section h2 {
  margin: 2.75rem 0 0.9rem;
  font-size: 1.4rem;
  line-height: 1.3;
}

.more-link {
  margin: 0;
  font-style: italic;
}

.abstract p {
  margin: 0 0 1.1em;
  hyphens: auto;
}

/* PDF and details */

.pdf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0;
}

.button {
  display: inline-block;
  padding: 0.7rem 1.25rem;
  border: 1px solid var(--button);
  border-radius: 2px;
  background: var(--button);
  color: var(--on-button);
  font-size: 1rem;
  line-height: 1.3;
  text-decoration: none;
}

.button:hover {
  background: var(--link-hover);
  border-color: var(--link-hover);
  color: var(--paper);
}

.button-outline {
  background: transparent;
  color: var(--ink);
}

.pdf-info {
  margin: 0.8rem 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.details dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.45rem 1.5rem;
  margin: 0;
  font-size: 1rem;
}

.details dt {
  font-weight: 600;
}

.details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.post-nav {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-style: italic;
}

/* Math */

.katex {
  font-size: 1.08em;
}

/* Keep short inline formulas such as (w·∇)w on one line. */
p > .katex {
  white-space: nowrap;
}

.katex-display {
  margin: 1em 0;
  padding: 0.25rem 0;
  overflow-x: auto;
  overflow-y: hidden;
}

/* Footer */

.site-footer {
  margin-top: 5rem;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0 0 0.4rem;
}

.site-footer a {
  color: inherit;
}

@media (max-width: 36rem) {
  body {
    font-size: 1.0625rem;
  }

  .site-header {
    margin-bottom: 2.5rem;
    padding-top: 2.25rem;
  }

  .site-title {
    font-size: 2.1rem;
  }

  .entry-title {
    font-size: 1.55rem;
  }

  .details dl {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .details dd {
    margin-bottom: 0.7rem;
  }
}
