/* ===== Page layout: centered column, no “paper” frame ===== */
:root {
  --maxw: 820px; /* a touch narrower to fit 2 pages more predictably */
  --pad: 48px;
  --bg: #fff;
  --fg: #111213;
  --muted: #5a5f69;
  --link: #0b57d0;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Source Serif 4", ui-serif, Georgia, Cambria, "Times New Roman",
    serif;
  font-size: 16px;
  line-height: 1.42; /* slightly tighter */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  hyphens: auto; /* nicer rag in print */
}

.page {
  min-height: 100%;
  display: grid;
  place-items: start center;
  padding-block: var(--pad);
  overflow: auto;
}
.page > .doc {
  width: min(var(--maxw), 92vw);
}

/* ===== LaTeX-like typography & spacing ===== */
p {
  margin: 0 0 7px;
} /* a hair tighter */

h1.unnumbered {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 16px 0 6px; /* reduce top margin */
  padding: 0 0 5px;
  border-bottom: 1px solid #e3e6ea;
}

/* Inline emphasis */
em {
  font-style: italic;
  opacity: 0.95;
}
strong {
  font-weight: 700;
}

/* Links */
a {
  color: var(--link);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ===== Lists: slightly tighter defaults ===== */
ul {
  margin: 2px 0 10px 1.25em;
  padding: 0;
}
ul > li {
  margin: 0.5px 0;
}
ul > li > p {
  margin: 0;
}

/* ===== Center blocks ===== */
.center {
  text-align: center;
}
.center p {
  margin-top: 0;
}
.center p:first-child span strong {
  display: inline-block;
  font-size: clamp(28px, 4vw, 32px);
  margin-bottom: 3px;
}
.center a {
  white-space: nowrap;
}

/* ===== Skills two-column ===== */
.multicols {
  column-count: 1;
  column-gap: 28px;
}
@media (min-width: 820px) {
  .multicols {
    column-count: 2;
  }
}
.multicols p {
  break-inside: avoid;
}

/* ===== Gentle rhythm between blocks ===== */
h1.unnumbered + p,
p + ul,
ul + p {
  margin-top: 6px;
}

p + p {
  margin-top: 7px;
}

/* ===== Experience/Project entry wrapper ===== */
.entry {
  break-inside: avoid;
  page-break-inside: avoid;
  margin-bottom: 6px;
}
.entry .spaced-content {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}
.entry .spaced-content span:last-child {
  white-space: nowrap;
}

/* ===== Dark mode ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --fg: #e9eaec;
    --muted: #9aa1ad;
    --link: #7aa2ff;
  }
  h1.unnumbered {
    border-bottom-color: rgba(255, 255, 255, 0.18);
  }
}

/* ===== Print tuning for ~2 pages ===== */
@media print {
  @page {
    /* Use Letter by default; switch to A4 if needed */
    size: Letter;
    margin: 0.6in; /* tighter than browser default */
  }
  :root {
    --bg: #fff;
    --fg: #000;
  }
  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
    line-height: 1.3;
  }
  .page {
    padding: 0;
  }
  .page > .doc {
    width: 100%;
  }
  a {
    color: #000;
    text-decoration: underline;
  }
  h1.unnumbered {
    border-color: #000;
  }

  /* Lists & spacing compressed slightly in print */
  ul {
    margin: 1px 0 8px 1.1em;
  }
  p {
    margin-bottom: 6px;
  }

  /* Keep sections/entries together as much as possible */
  .entry,
  .multicols p,
  h1.unnumbered {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* Optional: force page break before some sections if needed
     Uncomment one of these if you want Projects to start on page 2.
  */
  /* #selected-projects { page-break-before: always; } */

  /* Widow/orphan control (supported by some engines) */
  p,
  li {
    orphans: 2;
    widows: 2;
  }
}
