/* A restrained ink-on-paper palette in both color schemes. */

:root {
  color-scheme: light dark;
  --page: #fbfaf6;
  --surface: #f2f0e9;
  --text: #23221f;
  --muted: #6f6c64;
  --rule: #d9d5ca;
  --link: #5c45b8;
  --link-hover: #412c9d;
}

body {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1rem 1.25rem 4rem;
  /* Charter and its descendants: same shape as the default serif, better fitted
     for screens. Falls back to the system serif, never to a downloaded font. */
  font-family: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--page);
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  color: var(--link-hover);
}

h1,
h2,
h3 {
  line-height: 1.25;
  margin-top: 2rem;
}

hr {
  border: none;
  border-top: 1px solid;
  opacity: 0.15;
  margin: 2.5rem 0;
}

blockquote {
  margin-left: 0;
  padding-left: 1rem;
  border-left: 2px solid;
  opacity: 0.75;
}

code,
pre {
  font-size: 0.9em;
}

/* Same hairline as tables and <hr>, boxing the block rather than tinting it —
   the background stays the page background. */
pre {
  border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
  padding: 0.9rem 1rem;
  margin: 1.5rem 0;
}

/* Shiki highlights at build time and emits both palettes as custom properties.
   Picking one here means no client-side JavaScript and no theme flash. */
.shiki,
.shiki span {
  color: var(--shiki-light);
}

@media (prefers-color-scheme: dark) {
  .shiki,
  .shiki span {
    color: var(--shiki-dark);
  }
}

/* Long content (code, ascii diagrams) scrolls itself instead of pushing the
   page sideways. Tables get a wrapper for this — `display: block` on a table
   would stop border-collapse from applying. */
pre,
.scroll {
  overflow-x: auto;
  max-width: 100%;
}

.scroll {
  margin: 1.5rem 0;
}

/* Same hairline as <hr>: enough to separate rows, not a grid of boxes. */
table {
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.4rem 1rem 0.4rem 0;
  border-bottom: 1px solid;
}

/* The border colour is the text colour, so it has to be quieted down
   per element — opacity would fade the text with it. */
th {
  border-bottom-color: color-mix(in srgb, currentColor 35%, transparent);
}

td {
  border-bottom-color: color-mix(in srgb, currentColor 15%, transparent);
}

table tr:last-child td {
  border-bottom: none;
}

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

header {
  margin: 1.5rem 0 2.5rem;
  font-weight: bold;
}

footer {
  margin-top: 4rem;
  font-size: 0.9em;
  opacity: 0.7;
}

/* Dates: present but quiet, in the same color as the text. */
.date {
  font-size: 0.9em;
  opacity: 0.6;
  margin-top: 0.25rem;
}

/* Post list: title first, date underneath. No columns, no bullets. */
.posts {
  list-style: none;
  padding: 0;
  margin: 0;
}

.posts li {
  margin: 1.5rem 0;
}

.posts a {
  font-size: 1.15em;
}

/* The site remains deliberately quiet, but project cards make the portfolio
   easy to scan without turning it into a dashboard. */
.home-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(12rem, 1fr);
  gap: 1.5rem 2rem;
  align-items: start;
}

.home-columns h2,
.contact-card h2 {
  margin-top: 0;
}

.contact-card {
  padding: 1rem 1.15rem;
  border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
  border-radius: 0.7rem;
}

.contact-card ul {
  margin-bottom: 0;
  padding-left: 1.1rem;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.25rem 0 2rem;
}

.project-card {
  box-sizing: border-box;
  padding: 1.2rem;
  border: 1px solid color-mix(in srgb, currentColor 20%, transparent);
  border-radius: 0.7rem;
  background: var(--surface);
}

.project-card h3 {
  margin: 0.15rem 0 0.5rem;
}

.project-card p:last-child {
  margin-bottom: 0;
}

.project-card:hover {
  border-color: color-mix(in srgb, currentColor 42%, transparent);
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section-link {
  margin-top: -0.8rem;
}

.revival-card {
  margin: 1.25rem 0 2rem;
}

@media (max-width: 36rem) {
  .home-columns,
  .project-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #111110;
    --surface: #191918;
    --text: #e7e3da;
    --muted: #aaa69d;
    --rule: #33322f;
    --link: #b9a7ff;
    --link-hover: #d1c6ff;
  }

  body {
    -webkit-text-stroke: 1px var(--page);
    paint-order: stroke fill;
  }
}

/* A CV with the same ink, paper, and serif as the rest of the site.
   Topic selection behaves like a reader's highlighter. */
body:has(.cv-profile) {
  --cv-muted: var(--muted);
  --cv-rule: var(--rule);
  --cv-highlight: #fff0a6;
  /* OKLCH keeps every topic at the same perceived brightness across hues. */
  --cv-topic-lightness: 88%;
  --cv-topic-chroma: 0.145;
}
body:has(.cv-profile) ::selection { color: inherit; background: var(--cv-text-selection); }

.cv-document-header > h1 {
  margin: 0 0 0.3rem;
  font-size: 2.8rem;
  letter-spacing: -0.035em;
}

body:has(.cv-profile) > header { margin-bottom: 1.75rem; }

.cv-profile { margin-bottom: 1.75rem; }
.cv-headline { margin: 0; font-size: 1.4rem; line-height: 1.35; }
.cv-global-lead { margin: 1rem 0; }
.cv-links { margin: 0; font-size: 1rem; }
.cv-links a { white-space: nowrap; }
.cv-expertise { margin: 0.8rem 0 0; font-size: 0.95rem; }
.cv-credentials { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 2rem; margin-top: 1.8rem; padding-top: 1.2rem; border-top: 1px solid var(--cv-rule); }
.cv-credential-section h2 { margin: 0 0 0.35rem; font-size: 1.15rem; }
.cv-credential-section p { margin: 0; color: var(--cv-muted); font-size: 0.9rem; }

.cv-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 2rem;
  position: relative;
  padding: 1rem 0;
  border-block: 1px solid var(--cv-rule);
}
.cv-controls[hidden] { display: none; }
@media (max-width: 700px) {
  .cv-controls { grid-template-columns: 1fr; }
}
.cv-controls fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.cv-controls legend { padding: 0; margin-bottom: 0.5rem; font-weight: bold; font-size: 1.05rem; }
.cv-filter-hint { color: var(--cv-muted); font-size: 0.95rem; font-weight: normal; }
.cv-tag-instruction { grid-column: 1 / -1; margin: 0; padding-right: 3.5rem; color: var(--cv-muted); font-size: 0.95rem; }
.cv-topic-list { display: block; line-height: 1.5; }
.cv-filter-node { min-width: 0; }
.cv-filter-node[data-depth="0"] { padding: 0.15rem 0; }
.cv-topic-children { display: inline; margin: 0; }
.cv-topic-children[hidden] { display: none; }
.cv-topic-children.cv-topic-children-entering { animation: cv-topic-children-in 150ms ease-out both; }
.cv-topic-children > [data-depth] { display: inline; margin: 0; }
.cv-topic-children > [data-depth]:not(:last-child)::after { content: ", "; color: var(--cv-muted); }
.cv-topic-list > [data-depth="0"] { display: inline; padding: 0; }
.cv-topic-list > [data-depth="0"]:not(:last-child)::after { content: "; "; color: var(--cv-muted); }
.cv-topic-list .cv-topic-children::before { content: ": "; color: var(--cv-muted); }
.cv-topic-select {
  display: inline;
  padding: 0 0.08em;
  border: 0;
  color: inherit;
  background: none;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  cursor: pointer;
}
.cv-topic-list > [data-depth="0"] > .cv-topic-select { font-weight: bold; }
.cv-topic-select > .cv-topic-selector-mark { padding-inline: 0; }
.cv-topic-select:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }
.cv-topic-placeholder { color: var(--cv-muted); cursor: default; }
#cv-clear { position: absolute; top: 1.15rem; right: 0; padding: 0; margin: 0; border: 0; color: var(--link); background: none; font: inherit; font-size: 0.9rem; text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; }
#cv-clear:disabled { color: var(--cv-muted); text-decoration: none; cursor: default; }

.cv-section-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.3rem 1rem; margin: 1.8rem 0 0; }
.cv-section-heading h2 { margin: 0; font-size: 1.6rem; }
#cv-status { margin: 0; color: var(--cv-muted); font-size: 0.9rem; }
#cv-status a { color: inherit; text-decoration: underline; text-underline-offset: 0.2em; }
.cv-role { padding: 1.6rem 0; border-bottom: 1px solid var(--cv-rule); scroll-margin-top: 1rem; }
.cv-role-title { margin: 0; font-size: 1.35rem; line-height: 1.35; text-wrap: pretty; }
.cv-role-name { font-weight: normal; }
.cv-role-separator { padding: 0 0.15em; font-weight: normal; color: var(--cv-muted); }
.cv-role-meta { margin: 0.3rem 0 0.75rem; font-size: 0.95rem; color: var(--cv-muted); font-variant-numeric: tabular-nums; }
.cv-role-meta time { white-space: nowrap; }
.cv-summary { margin: 0; }
.cv-points { margin: 0.7rem 0 0; padding-left: 1.15rem; }
.cv-points li { padding-left: 0.15rem; margin: 0.3rem 0; }
.cv-topic-mark {
  padding-inline: 0;
  color: inherit;
  background-repeat: no-repeat;
  background-position: left center;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.cv-topic-mark-entering { animation: cv-highlight-in 170ms ease-out both; }
.cv-highlightable {
  color: inherit;
  background: transparent;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.cv-highlightable,
.cv-topic-mark[data-highlightable-topics] { cursor: pointer; }
.cv-highlightable:focus-visible,
.cv-topic-mark[data-highlightable-topics]:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.cv-highlightable:hover,
.cv-topic-mark:hover {
  background: linear-gradient(178deg, transparent 10%, var(--topic-hover-color) 10% 91%, transparent 91%);
  box-shadow: none;
}
html.cv-scroll-lock,
html.cv-scroll-lock body,
html.cv-scroll-lock #cv-app { overflow-anchor: none; }
.cv-content-entering { animation: cv-content-in 170ms ease-out both; }
.cv-topic-suggestions { margin: 0.65rem 0 0; font-size: 0.85rem; }
.cv-topic-suggestions .cv-topic-select { font-size: inherit; }
.cv-topic-suggestions-label { color: var(--cv-muted); }
.cv-topic-suggestions-label::after { content: ": "; }
.cv-suggestion-options { display: inline; }
.cv-evidence { margin: 0.7rem 0 0; font-size: 0.95rem; }
.cv-experience-disclosure { margin: 0.65rem 0 0; font-size: 0.85rem; color: var(--cv-muted); }
.cv-experience-disclosure button { padding: 0; border: 0; background: none; font: inherit; color: var(--link); text-decoration: underline; cursor: pointer; user-select: none; }
.cv-experience-disclosure[hidden] { display: none; }
@media print { .cv-experience-disclosure { display: none; } }
.cv-earlier { padding: 1.6rem 0; }
.cv-archive { margin-top: 0.9rem; }
.cv-archive > summary { width: fit-content; color: var(--link); cursor: pointer; }
.cv-archive > summary:focus-visible { outline: 2px solid var(--link); outline-offset: 4px; }
.cv-archive[open] > summary { margin-bottom: 0.5rem; }
.cv-experience-show-highlights { display: none; }
.cv-experience-details[open] .cv-experience-show-full { display: none; }
.cv-experience-details[open] .cv-experience-show-highlights { display: inline; }
.cv-archive > .cv-role {
  margin-left: 1rem;
  padding-left: 1rem;
  border-left: 1px solid var(--cv-rule);
}
.cv-archive > .cv-role .cv-role-title { font-size: 1.15rem; }
.cv-archive .cv-role:last-child { border-bottom: 0; padding-bottom: 0; }
.cv-earlier + .cv-earlier { border-top: 1px solid var(--cv-rule); }
.cv-export-actions { margin: -0.75rem 0 1.5rem; font-size: 0.95rem; }
.cv-export-actions button { padding: 0; border: 0; background: none; color: var(--link); text-decoration: underline; font: inherit; cursor: pointer; }
.cv-export-actions button:disabled { color: var(--cv-muted); cursor: wait; }
#cv-pdf-status { margin-left: 0.6rem; color: var(--cv-muted); font-size: 0.85rem; }
.cv-generation-note { margin: 0.25rem 0 0.75rem; color: var(--cv-muted); font-size: 0.85rem; }
.cv-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (prefers-color-scheme: dark) {
  body:has(.cv-profile) {
    --cv-highlight: #554914;
    --cv-topic-lightness: 82%;
  }
}

@keyframes cv-highlight-in {
  from { background-size: 0% 100%; box-shadow: none; }
  to { background-size: 100% 100%; }
}

@keyframes cv-topic-children-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cv-content-in {
  from { opacity: 0; transform: translateY(0.25rem); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .cv-topic-mark-entering,
  .cv-topic-children.cv-topic-children-entering,
  .cv-content-entering { animation: none; }
}

@media (max-width: 30rem) {
  body:has(.cv-profile) { padding-inline: 1rem; }
  .cv-document-header > h1 { font-size: 2.35rem; }
  .cv-headline { font-size: 1.25rem; }
  .cv-controls legend { padding-right: 5rem; }
  .cv-filter-hint { display: none; }
  #cv-clear { font-size: 0.9rem; }
  .cv-section-heading { margin-top: 1.7rem; }
  .cv-role-title { font-size: 1.25rem; }
  .cv-role { padding-block: 1.4rem; }
  .cv-credentials { grid-template-columns: 1fr; }
}

@media print {
  @page { margin: 9mm; }
  body:has(.cv-profile) { max-width: none; padding: 0; color: #000; background: #fff; color-scheme: light; -webkit-text-stroke: 0; --page: #fff; --surface: #fff; --text: #000; --muted: #555; --rule: #ccc; --link: #000; --link-hover: #000; --cv-highlight: #fff0a6; --cv-topic-lightness: 88%; }
  .cv-document { line-height: var(--cv-pdf-leading); --cv-muted: var(--cv-pdf-muted); --cv-rule: var(--cv-pdf-rule); --link: var(--cv-pdf-link); }
  [data-pdf-block] { font-size: var(--cv-pdf-font-size) !important; margin-block: 0 var(--cv-pdf-after) !important; }
  body:has(.cv-profile) > header,
  body:has(.cv-profile) > footer,
  .cv-controls, #cv-status, .cv-export-actions { display: none; }
  .cv-credentials { display: block; margin-top: 4pt; padding-top: 3pt; }
  .cv-credential-section { break-inside: avoid; margin-top: 3pt; }
  .cv-profile { margin-bottom: 5pt; }
  .cv-section-heading { margin-top: 5pt; }
  .cv-points { margin-top: 2pt; }
  .cv-role, .cv-earlier { break-inside: avoid; padding: 4pt 0; }
  .cv-role-title { break-after: avoid; }
  .cv-role mark { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .cv-generation-note { display: block; break-inside: avoid; }
  .cv-generation-note a { overflow-wrap: anywhere; }
}

/* Native controls keep the shared typographic treatment. */
.cv-topic-select { font-family: inherit; }
.cv-topic-select:disabled { cursor: default; }
.cv-topic-suggestions[hidden], .cv-fallback-details[hidden] { display: none; }
body:has(.cv-profile) { --cv-text-selection: oklch(var(--cv-topic-lightness) var(--cv-topic-chroma) 210 / 0.58); }
.cv-fallback-details { margin-top: 0.7rem; }

@media print {
  .cv-topic-suggestions, .cv-archive, .cv-fallback-details { display: none; }
}

/* Local design alternatives: ?projects=inset or ?projects=margin. */
.cv-design-options { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin-bottom: 1.5rem; font-size: 0.85rem; color: var(--cv-muted); }
.cv-design-options a { text-decoration: underline; text-underline-offset: 0.2em; }
.cv-design-options a[aria-current] { color: var(--text); font-weight: bold; text-decoration: none; }
.cv-project-insert { margin: 1.2rem 0 0.2rem; }
.cv-project-notes { display: grid; grid-template-columns: repeat(var(--cv-project-columns), minmax(0, 1fr)); gap: 0.85rem 1.5rem; }
.cv-project-label { grid-column: 1 / -1; margin: 0; color: var(--cv-muted); font-size: 0.8rem; line-height: 1.4; break-after: avoid; }
.cv-project-note { margin: 0; padding: 0.65rem 0.8rem; border: 1px solid var(--cv-rule); font-size: 0.88rem; line-height: 1.45; break-inside: avoid; }
.cv-project-note a { font-weight: bold; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
.cv-project-description { display: block; color: var(--text); margin-top: 0.25rem; }
@media screen and (min-width: 90rem) {
  .cv-projects-margin .cv-project-insert { position: relative; margin: 0; height: 0; }
  .cv-projects-margin .cv-project-notes { position: absolute; top: 0.4rem; left: calc(100% + 2.5rem); width: 17rem; grid-template-columns: 1fr; gap: 0.85rem; }
}
@media (max-width: 38rem) {
  .cv-project-notes { grid-template-columns: 1fr; }
  .cv-projects-margin .cv-project-insert { margin-inline: 0; }
}
@media print {
  .cv-design-options { display: none; }
  .cv-project-insert, .cv-projects-margin .cv-project-insert { position: static; height: auto; margin: 4pt 0; }
  .cv-project-notes, .cv-projects-margin .cv-project-notes { position: static; width: auto; display: grid; grid-template-columns: repeat(var(--cv-project-columns), minmax(0, 1fr)); gap: var(--cv-pdf-project-padding) var(--cv-pdf-project-gap); }
  .cv-project-label { font-size: 7pt; }
  .cv-project-note { padding: var(--cv-pdf-project-padding); margin: 0; }
  .cv-project-description { display: block; margin-top: 2pt; }
  .cv-project-note mark { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
