/* Fonts (self-hosted, SIL Open Font License — see assets/fonts/README.md) */

@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 400; font-display: swap; src: url("assets/fonts/newsreader-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Newsreader"; font-style: italic; font-weight: 400; font-display: swap; src: url("assets/fonts/newsreader-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 500; font-display: swap; src: url("assets/fonts/newsreader-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("assets/fonts/ibm-plex-sans-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: italic; font-weight: 400; font-display: swap; src: url("assets/fonts/ibm-plex-sans-400-italic.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("assets/fonts/ibm-plex-sans-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("assets/fonts/ibm-plex-sans-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("assets/fonts/ibm-plex-mono-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("assets/fonts/ibm-plex-mono-500-normal.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --background: #f6f5f2;
  --text: #191919;
  --body: #3d3d3a;
  --muted: #6c6c67;
  --faint: #8f8f88;
  --line: rgba(25, 25, 25, 0.12);
  --line-strong: rgba(25, 25, 25, 0.28);
  --accent: #1d5f4a;
  --photo-bg: #e7e7e2;

  --font-display: "Newsreader", "Iowan Old Style", Georgia, serif;
  --font-sans: "IBM Plex Sans", ui-sans-serif, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --page: 68rem;
  --gutter: clamp(1rem, 5vw, 3rem);
}

/* Dark palette: follows the system unless the toggle chose a theme (html[data-theme]) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --background: #121412;
    --text: #ebe9e4;
    --body: #c4c3bd;
    --muted: #9b9b94;
    --faint: #7a7a74;
    --line: rgba(255, 255, 255, 0.12);
    --line-strong: rgba(255, 255, 255, 0.3);
    --accent: #7fcfb0;
    --photo-bg: #262825;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #121412;
  --text: #ebe9e4;
  --body: #c4c3bd;
  --muted: #9b9b94;
  --faint: #7a7a74;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.3);
  --accent: #7fcfb0;
  --photo-bg: #262825;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--background);
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  color: var(--body);
  background: var(--background);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

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

::selection {
  color: var(--background);
  background: var(--accent);
}

em,
.serif-italic {
  font-family: var(--font-display);
  font-style: italic;
}

.wrap {
  width: 100%;
  max-width: calc(var(--page) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.mono,
.eyebrow,
.caption {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 1.25rem;
  color: var(--muted);
}

.arrow {
  display: inline-block;
  margin-left: 0.15em;
  font-family: var(--font-sans);
  font-size: 0.85em;
  transition: transform 160ms ease;
}

a:hover .arrow {
  transform: translate(2px, -2px);
}

/* Header */

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.4rem;
  padding-bottom: 1.4rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
}

.brand img {
  width: 1.75rem;
  height: 1.75rem;
  object-fit: cover;
  border-radius: 50%;
  background: var(--photo-bg);
}

.site-nav {
  display: flex;
  gap: clamp(0.9rem, 3vw, 1.75rem);
}

.site-nav a {
  padding: 0.25rem 0;
  color: var(--muted);
  font-size: 0.92rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 160ms ease, border-color 160ms ease;
}

.site-nav a:hover {
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--text);
}

.header-end {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 3vw, 1.75rem);
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  margin: -0.25rem -0.4rem -0.25rem 0;
  padding: 0;
  color: var(--muted);
  background: none;
  border: 1px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--line);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

/* Show the sun in dark mode (switch to light), the moon in light mode */
.theme-toggle .icon-sun,
:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }

  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }
}

/* Without JavaScript the button can't do anything, so hide it */
:root:not(.js) .theme-toggle {
  display: none;
}

main {
  flex: 1;
}

/* Home */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 5rem);
  padding-top: clamp(2.5rem, 8vw, 6rem);
  padding-bottom: clamp(3rem, 8vw, 6rem);
}

.hero h1 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(3.4rem, 8.5vw, 6.4rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 0.95;
}

.hero h1 em {
  color: var(--muted);
}

.dot {
  color: var(--accent);
}

.hero .lede {
  max-width: 30rem;
  margin: 1.75rem 0 0;
  font-size: clamp(1.05rem, 2.2vw, 1.2rem);
  line-height: 1.6;
}

.contact-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.4rem;
  max-width: 30rem;
  margin-top: 2.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.contact-row a {
  color: var(--muted);
  text-decoration: none;
  transition: color 160ms ease;
}

.contact-row a:hover {
  color: var(--text);
}

.contact-row .primary {
  color: var(--text);
  border-bottom: 1px solid var(--line-strong);
}

.figure {
  margin: 0;
}

.figure img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--photo-bg);
  filter: saturate(0.92);
}

.figure figcaption {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.7rem;
  color: var(--faint);
}

/* Inner pages */

.page-head {
  padding-top: clamp(2.5rem, 7vw, 5rem);
  padding-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

.page-head .eyebrow {
  margin-bottom: 1.6rem;
}

.page-head h1 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 7vw, 4.6rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1;
}

.page-head h1 em {
  color: var(--muted);
}

.page-head p {
  max-width: 34rem;
  margin: 1.1rem 0 0;
  color: var(--muted);
}

.section-rule {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  color: var(--muted);
}

.section-rule::after {
  flex: 1;
  height: 1px;
  content: "";
  background: var(--line);
  transform: translateY(-0.25em);
}

.section-rule .num {
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: 0;
  text-transform: none;
}

.page-body {
  padding-bottom: clamp(3rem, 8vw, 6rem);
}

/* Experience */

.jobs {
  margin: 0;
  padding: 0;
  list-style: none;
}

.job {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 0.5rem 2.5rem;
  padding: 2.25rem 0;
  border-bottom: 1px solid var(--line);
}

.job:last-child {
  border-bottom: 0;
}

.job-dates {
  margin: 0.55rem 0 0;
  color: var(--faint);
  white-space: nowrap;
}

.job h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.5vw, 2rem);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.15;
}

.job h2 a {
  text-decoration: none;
}

.job h2 a:hover {
  color: var(--accent);
}

.job-role {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-style: italic;
}

.job ul {
  max-width: 44rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.job li {
  position: relative;
  padding-left: 1.1rem;
  font-size: 0.97rem;
}

.job li + li {
  margin-top: 0.5rem;
}

.job li::before {
  position: absolute;
  left: 0;
  color: var(--faint);
  content: "–";
}

.after-note {
  margin: 2rem 0 0;
  color: var(--muted);
}

.after-note a,
.prose a {
  color: var(--text);
  text-decoration-color: var(--line-strong);
  text-underline-offset: 0.2em;
}

.after-note a:hover,
.prose a:hover {
  text-decoration-color: var(--accent);
}

/* Links */

.link-rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.link-rows a {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 1.5rem;
  padding: 1.5rem 0;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.link-rows .caption {
  color: var(--faint);
}

.link-rows .value {
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 4vw, 2.1rem);
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 160ms ease;
}

.link-rows a:hover .value {
  color: var(--accent);
}

.link-rows .arrow {
  color: var(--muted);
  font-size: 1.2rem;
}

/* Blog */

.posts {
  margin: 0;
  padding: 0;
  list-style: none;
}

.posts a {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 1.5rem;
  padding: 1.5rem 0;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.posts time {
  color: var(--faint);
}

.posts .title {
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3.5vw, 1.8rem);
  line-height: 1.2;
  transition: color 160ms ease;
}

.posts .summary {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.95rem;
}

.posts a:hover .title {
  color: var(--accent);
}

.posts .arrow {
  color: var(--muted);
}

.empty {
  color: var(--muted);
}

.post-head > * {
  max-width: 44rem;
}

.post-head .back {
  color: var(--muted);
  text-decoration: none;
}

.post-head .back:hover {
  color: var(--text);
}

.post-head time {
  display: block;
  margin-top: 1.25rem;
  color: var(--faint);
}

.prose {
  max-width: 40rem;
  font-size: 1.06rem;
  line-height: 1.75;
}

.prose > :first-child {
  margin-top: 0;
}

.prose h2,
.prose h3 {
  margin: 2.5rem 0 0.75rem;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.prose h2 {
  font-size: 1.8rem;
}

.prose h3 {
  font-size: 1.4rem;
}

.prose strong {
  color: var(--text);
  font-weight: 600;
}

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

.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

.prose pre {
  overflow-x: auto;
  padding: 1rem 1.15rem;
  font-size: 0.9rem;
  line-height: 1.6;
  border: 1px solid var(--line);
}

.prose blockquote {
  margin: 1.75rem 0;
  padding-left: 1.25rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-style: italic;
  line-height: 1.5;
  border-left: 1px solid var(--accent);
}

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

/* Footer */

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
}

.footer-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding-top: clamp(2rem, 5vw, 3rem);
  padding-bottom: clamp(1.5rem, 4vw, 2rem);
}

.footer-cta p {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  letter-spacing: -0.015em;
  line-height: 1.15;
}

.footer-cta p em {
  color: var(--muted);
}

.footer-cta a {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
}

.footer-cta a:hover {
  border-bottom-color: var(--accent);
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-top: 1.25rem;
  padding-bottom: 2rem;
  color: var(--faint);
  background: linear-gradient(var(--line), var(--line)) center top / calc(100% - 2 * var(--gutter)) 1px no-repeat;
}

.footer-meta nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.footer-meta a {
  text-decoration: none;
}

.footer-meta a:hover {
  color: var(--text);
}

/* Small screens */

@media (max-width: 760px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 1.5rem;
  }

  .hero .figure {
    order: -1;
    max-width: 22rem;
  }

  .job {
    grid-template-columns: 1fr;
    gap: 0.4rem;
    padding: 1.75rem 0;
  }

  .job-dates {
    order: -1;
    margin: 0;
  }

  .link-rows a,
  .posts a {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.35rem 1rem;
  }

  .link-rows .caption,
  .posts time {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  .brand span {
    display: none;
  }

  .site-nav,
  .header-end {
    gap: 0.95rem;
  }

  .footer-meta {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
