/* thomasdigiusto.com: shared style for the home page and every article.
   Pages link it relatively (assets/style.css at the root, ../assets/style.css in an article). */

:root {
  --bg: #fcfcfb;
  --fg: #1c1d21;
  --muted: #61646b;
  --line: #e5e6e9;
  --soft: #f3f4f6;
  --accent: #2f6fd6;
  --accent-soft: #e8f0fc;
  --code-bg: #f4f5f7;
  --radius: 10px;
  --measure: 70ch;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Ubuntu, Cantarell, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --fg: #e4e5e8;
    --muted: #9a9ea8;
    --line: #2a2d34;
    --soft: #191c21;
    --accent: #7aa7f5;
    --accent-soft: #1b2638;
    --code-bg: #1a1d23;
  }
}

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

html {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 106.25%;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

body { margin: 0; }

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* header and footer */
.site-header {
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}
.site-name {
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
}
.site-name:hover { color: var(--accent); }
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}
.site-nav a:hover { color: var(--accent); }

.site-footer {
  margin-top: 4rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}
.site-footer a { color: var(--muted); }

main { padding-top: 2.5rem; }

/* titles and text */
.page-title {
  font-size: clamp(1.9rem, 1.3rem + 2.6vw, 2.7rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 0.6rem;
}
.page-meta {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 2.5rem;
}

h1, h2, h3, h4 {
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 2.4em 0 0.6em;
}
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }

p, ul, ol, blockquote, pre, figure, table { margin: 0 0 1.25em; }
ul, ol { padding-left: 1.4em; }
li { margin: 0.3em 0; }
li > ul, li > ol { margin: 0.3em 0 0; }
strong { font-weight: 650; }

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

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.5em 0;
}

blockquote {
  margin-left: 0;
  padding: 0.6em 1.1em;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--fg);
}
blockquote > :last-child { margin-bottom: 0; }

/* figures */
figure { margin: 2em 0; text-align: center; }
figure img, p > img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
figcaption {
  margin-top: 0.6em;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}
@media (prefers-color-scheme: dark) {
  /* the charts are drawn on white: show them on a light card */
  figure img, p > img {
    background: #fff;
    padding: 0.6rem;
    border-color: transparent;
  }
}

/* tables */
table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  -webkit-overflow-scrolling: touch;
}
th, td {
  padding: 0.45em 0.9em;
  text-align: left;
  vertical-align: top;
}
th {
  font-weight: 600;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
tbody tr:nth-child(odd) { background: var(--soft); }
td:first-child, th:first-child { padding-left: 0.6em; }
caption { color: var(--muted); font-size: 0.9rem; margin-bottom: 0.5em; }

/* code */
code, pre, kbd { font-family: var(--mono); font-size: 0.88em; }
:not(pre) > code {
  background: var(--code-bg);
  padding: 0.12em 0.35em;
  border-radius: 5px;
}
pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9em 1.1em;
  overflow-x: auto;
  line-height: 1.55;
}
pre code { background: none; padding: 0; font-size: 0.86rem; }
div.sourceCode { margin: 0 0 1.25em; }
pre > code.sourceCode > span { display: inline; }
pre > code.sourceCode > span > a:first-child::before { text-decoration: none; }
code span.kw, code span.cf { color: #a626a4; }
code span.dt { color: #c18401; }
code span.dv, code span.bn, code span.fl { color: #986801; }
code span.st, code span.ch, code span.ss { color: #50a14f; }
code span.co { color: #8a8f98; font-style: italic; }
code span.fu { color: #4078f2; }
code span.op { color: inherit; }
code span.pp { color: #e45649; }
@media (prefers-color-scheme: dark) {
  code span.kw, code span.cf { color: #c678dd; }
  code span.dt { color: #e5c07b; }
  code span.dv, code span.bn, code span.fl { color: #d19a66; }
  code span.st, code span.ch, code span.ss { color: #98c379; }
  code span.co { color: #7f848e; }
  code span.fu { color: #61afef; }
  code span.pp { color: #e06c75; }
}

/* home page: the article list */
.intro { color: var(--muted); font-size: 1.1rem; margin-bottom: 2.5rem; }
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li {
  margin: 0;
  padding: 1.4rem 0;
  border-top: 1px solid var(--line);
}
.post-list li:last-child { border-bottom: 1px solid var(--line); }
.post-list h2 { font-size: 1.3rem; margin: 0 0 0.25rem; }
.post-list h2 a { color: var(--fg); text-decoration: none; }
.post-list h2 a:hover { color: var(--accent); }
.post-list time { color: var(--muted); font-size: 0.9rem; }
.post-list p { margin: 0.4rem 0 0; color: var(--muted); }

.back { margin-top: 3rem; }
.back a { text-decoration: none; }

@media (max-width: 600px) {
  html { font-size: 100%; }
  main { padding-top: 1.75rem; }
  h2 { font-size: 1.35rem; }
}

@media print {
  .site-header, .site-footer, .back { display: none; }
  html { background: #fff; color: #000; }
  a { color: inherit; }
}
