/* Appearance and document defaults. */
:root {
  color-scheme: light;
  --paper: #f7f5ef;
  --surface: #efeee7;
  --ink: #2b302c;
  --muted: #4a5149;
  --line: #c6ccc1;
  --accent: #3e5241;
  --selection: #dce3d7;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1e2220;
  --surface: #292e2b;
  --ink: #e7e9e2;
  --muted: #b5beb2;
  --line: #505a50;
  --accent: #adc5ad;
  --selection: #3b4c3e;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body,
address,
dl,
dd,
figure,
h1,
h2,
h3,
ul,
p {
  margin: 0;
}

body {
  font-size: 1.125rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

button {
  font: inherit;
}

address {
  font-style: normal;
}

h1 {
  font-size: 1.875rem;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.3125rem;
  line-height: 1.45;
  font-weight: 500;
}

h3 {
  font-size: 1.125rem;
  line-height: 1.5;
  font-weight: 500;
}

strong,
dt {
  color: var(--ink);
  font-weight: 600;
}

a,
.text-button {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 0.25rem;
}

.text-button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: start;
}

.site-header a,
.site-nav a,
.text-button,
.action-link,
.blog-back,
.blog-index-entry > a,
.gemtext-link > a,
.cv-identity address > a {
  display: inline-flex;
  min-width: 2.75rem;
  min-height: 2.75rem;
  max-width: 100%;
  align-items: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

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

.meta,
.message {
  color: var(--muted);
}

noscript {
  display: block;
  margin-top: 0.5lh;
  color: var(--muted);
}

/* Page navigation and layout. */
.site-shell {
  width: min(100%, calc(62ch + 4rem), 46rem);
  margin-inline: auto;
  padding: 1.875rem 2rem 2.125rem;
}

.site-header,
.site-footer,
.site-nav,
.reading-controls {
  display: flex;
  flex-wrap: wrap;
}

.site-header,
.site-footer {
  align-items: baseline;
}

.site-header {
  justify-content: space-between;
  gap: 0 1rem;
}

.site-name {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
}

.site-nav {
  gap: 0;
  margin-inline: -0.75rem;
  margin-top: 0.4375rem;
  font-size: 1rem;
}

.site-nav a {
  /* Equal padding keeps label spacing even while preserving generous targets. */
  padding-inline: 0.75rem;
  color: var(--muted);
  text-decoration: none;
}

.site-nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.375rem;
}

.site-nav a:hover,
.site-name:hover {
  text-decoration: underline;
}

.site-name:hover {
  color: var(--accent);
}

main {
  max-width: min(62ch, 42rem);
  margin-top: 2rem;
  overflow-wrap: anywhere;
}

main:focus {
  outline: 3px solid var(--ink);
  outline-offset: 0.375rem;
}

.site-footer {
  justify-content: flex-end;
  gap: 0 1.25rem;
  margin-top: 2.5rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.skip-link {
  position: absolute;
  z-index: 10;
  inset: 0.5rem auto auto 0.5rem;
  padding: 0.625rem 0.875rem;
  max-width: calc(100% - 1rem);
  transform: translateY(calc(-100% - 1rem));
  background: var(--paper);
  color: var(--ink);
}

.skip-link:focus {
  transform: none;
  outline: 3px solid var(--ink);
  outline-offset: 0.125rem;
}

.stack {
  display: grid;
  gap: 1.25rem;
}

.stack--spacious {
  gap: 2rem;
}

:where(.stack, .cv-identity address, .site-header, .site-footer, .reading-controls) > * {
  min-width: 0;
  max-width: 100%;
}

.about-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7.5rem;
  align-items: start;
  gap: 2rem;
}

.about-portrait {
  width: 7.5rem;
  max-width: 100%;
}

.about-portrait img {
  display: block;
  width: 100%;
  height: auto;
}

.reading-controls {
  align-items: center;
  gap: 0 1rem;
  font-size: 0.875rem;
}

/* CV. */
.document-title {
  font-size: 1.5em;
  line-height: 1.3;
}

.notice {
  gap: 0.25rem;
  padding: 1rem;
  border: 1px solid var(--line);
  background: var(--surface);
}

.notice,
.cv-download {
  font-size: 1rem;
}

.entry + .entry {
  margin-top: 0.75rem;
}

.entry-header,
.cv-identity,
.cv-education > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.25rem;
}

.cv-identity {
  align-items: end;
  gap: 1.25rem;
}

.cv-identity address {
  display: grid;
  justify-items: start;
}

.bullet-list,
.blog-post ul {
  padding-inline-start: 1.25rem;
  list-style-type: disc;
}

.bullet-list {
  gap: 0.75rem;
}

.bullet-list li::marker,
.blog-post li::marker {
  color: var(--muted);
}

.blog-date {
  color: var(--muted);
  font-size: 0.875rem;
}

/* Gemini content. */
.blog-date {
  display: block;
}

.blog-back {
  font-size: 1rem;
}

.blog-post > * {
  min-width: 0;
}

.blog-post > :not(.visually-hidden) ~ :not(.visually-hidden) {
  margin-top: 1.25rem;
}

.blog-post > h2:not(:first-child),
.blog-post > h3:not(:first-child) {
  margin-top: 2rem;
}

.blog-post > h2 + *,
.blog-post > h3 + * {
  margin-top: 0.625rem;
}

.blog-post blockquote {
  margin-inline: 0;
  padding-inline-start: 1rem;
  border-inline-start: 2px solid var(--line);
}

.blog-post pre {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.875em;
  max-width: 100%;
  min-height: 1lh;
  padding: 1rem;
  background: var(--surface);
  line-height: 1.5;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
  tab-size: 4;
}

@media (max-width: 40rem) {
  .about-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
  }
}

@media (max-width: 30rem) {
  .site-shell {
    padding: 1.25rem 1.25rem 1.625rem;
  }

  h1 {
    font-size: 1.6875rem;
  }
}

@media (forced-colors: active) {
  :root,
  :root[data-theme="dark"] {
    --paper: Canvas;
    --surface: Canvas;
    --ink: CanvasText;
    --muted: CanvasText;
    --line: CanvasText;
    --accent: LinkText;
    --selection: Highlight;
  }

  ::selection {
    color: HighlightText;
  }
}

@media print {
  :root,
  :root[data-theme="dark"] {
    color-scheme: light;
    --paper: #fff;
    --surface: #fff;
    --ink: #000;
    --muted: #333;
    --accent: #000;
  }

  body {
    font-size: 11pt;
    line-height: 1.5;
  }

  .site-shell {
    width: 100%;
    padding: 0;
  }

  main {
    max-width: none;
    margin: 0;
  }

  .site-header,
  .site-nav,
  .site-footer,
  .skip-link,
  .reading-controls,
  .action-link,
  .blog-back,
  button {
    display: none !important;
  }

  h1,
  h2,
  h3,
  .entry-header {
    break-after: avoid;
  }

  p,
  li {
    orphans: 3;
    widows: 3;
  }

  .blog-post pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
}
