/* Lorenzo Sciarretta: one column, one typeface, light and dark themes. */

:root {
  --bg: #ffffff;
  --fg: #1c1d1f;
  --muted: #6a6d73;
  --rule: #e3e4e6;
  --link: #215caf;
  --tint: #f4f6fa;
  color-scheme: light;
}

/* Dark: follows the system unless the visitor picked light with the toggle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17181b;
    --fg: #e6e6e3;
    --muted: #9a9ca1;
    --rule: #2c2e33;
    --link: #8fb3ec;
    --tint: #1f2126;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #17181b;
  --fg: #e6e6e3;
  --muted: #9a9ca1;
  --rule: #2c2e33;
  --link: #8fb3ec;
  --tint: #1f2126;
  color-scheme: dark;
}

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

body {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1.25rem;
  background: var(--bg);
  color: var(--fg);
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.125rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

h1, h2, h3 { font-weight: 600; line-height: 1.25; }
h1 { font-size: 2.25rem; margin: 0 0 1.5rem; letter-spacing: -0.01em; }
h2 { font-size: 1.35rem; margin: 3rem 0 1rem; }
h3 { font-size: 1.1rem; margin: 2rem 0 0.5rem; }

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

::selection { background: rgba(255, 240, 0, 0.7); color: #000; }
mark { background: rgba(255, 240, 0, 0.5); color: inherit; padding: 0 0.15em; }

/* Header & footer */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 2rem 0 3rem;
}
.site-header a { color: var(--fg); text-decoration: none; }
.site-name { font-weight: 600; }
.site-header nav a { margin-left: 1.25rem; color: var(--muted); }
.site-header nav a:hover { color: var(--fg); }
#theme-toggle {
  margin-left: 1.25rem;
  padding: 0.25rem;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  vertical-align: -0.2em;
}
#theme-toggle:hover { color: var(--fg); }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-top: 5rem;
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.95rem;
}
.site-footer p { margin: 0; }
.site-footer a { color: var(--muted); margin-left: 1rem; }
.site-footer a:first-child { margin-left: 0; }

/* Home */
.intro { display: grid; grid-template-columns: 1fr 11rem; gap: 2.5rem; align-items: start; }
.intro p:first-of-type { margin-top: 0; }
.profile { font-size: 0.95rem; line-height: 1.45; color: var(--muted); }
.profile img { display: block; width: 100%; aspect-ratio: 1; border-radius: 50%; object-fit: cover; margin-bottom: 1rem; }
.facts { list-style: none; padding: 0; margin: 0 0 1rem; }
.facts li + li { margin-top: 0.5rem; }
.icons { display: flex; gap: 1rem; margin: 0; }
.icons a { color: var(--muted); }
.icons a:hover { color: var(--fg); }
.icons svg { display: block; }

/* Dated lists: focus, work, notes */
.entries { list-style: none; padding: 0; margin: 0; }
.entries li { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem; margin-bottom: 1.1rem; }
.entries .when { color: var(--muted); font-variant-numeric: tabular-nums; }
.entries .what { display: block; }
.entries .detail { display: block; color: var(--muted); font-size: 1rem; }

@media (max-width: 34rem) {
  .intro { grid-template-columns: 1fr; gap: 1.5rem; }
  .profile { order: -1; display: grid; grid-template-columns: 6.5rem 1fr; gap: 1.25rem; align-items: center; }
  .profile img { margin: 0; }
  .entries li { grid-template-columns: 1fr; gap: 0; }
}

/* Notes */
.note h1 { margin-bottom: 0.5rem; }
.note blockquote { margin: 1.5rem 0; padding-left: 1rem; border-left: 3px solid var(--rule); color: var(--muted); }
.note pre { overflow-x: auto; padding: 1rem; background: var(--tint); font-size: 0.9rem; }
.note table { border-collapse: collapse; display: block; overflow-x: auto; }
.note th, .note td { border: 1px solid var(--rule); padding: 0.35rem 0.6rem; }
mjx-container[display="true"] { overflow-x: auto; overflow-y: hidden; }

.post-header { margin-bottom: 2rem; }
.post-track, .post-meta { color: var(--muted); font-size: 1rem; }

.post-toc { margin: 0 0 2.5rem; padding: 1rem 1.25rem; background: var(--tint); font-size: 1rem; }
.post-toc p { margin: 0 0 0.25rem; }
.post-toc ul { margin: 0; padding-left: 1.25rem; }

.callout { margin: 1.5rem 0; padding: 0.75rem 1.25rem; border-left: 3px solid var(--link); background: var(--tint); }
.callout-label { font-weight: 600; }

.post-nav { display: flex; justify-content: space-between; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.post-nav-prev::before { content: "← "; }
.post-nav-next::after { content: " →"; }

.back { margin-top: 3rem; }

.tracks { padding-left: 1.25rem; }
.tracks li + li { margin-top: 0.5rem; }
