/* One theme: light, on a cream page (easier to read than white or dark). */
:root {
  color-scheme: light;
  --bg: #f6f1e4;
  --fg: #1b1c1f;
  --muted: #5e5f66;
  --line: #e0d9c7;
  --link: #0b6b5d;
  --todo-bg: #fff1a8;
  --todo-fg: #5a4300;
  --code-bg: #ebe4d3;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  color: var(--fg);
  background: var(--bg);
  scroll-padding-top: 4rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0 auto;
  padding: 4rem 1.5rem 4rem;
  max-width: 44rem;
}

p {
  margin: 0 0 1rem;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover,
a:focus {
  text-decoration-thickness: 2px;
}

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

code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

/* Header and nav */

header {
  margin-bottom: 1.5rem;
}

.name {
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin: 0;
}

.role {
  margin: 0.4rem 0 0;
  font-size: 1.05rem;
  color: var(--muted);
}

.contact {
  margin: 0.3rem 0 0;
  font-size: 0.95rem;
}

.name a {
  color: inherit;
  text-decoration: none;
}

nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  padding: 0.75rem 0;
  margin-bottom: 3rem;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

nav a:hover,
nav a:focus,
nav a[aria-current="page"] {
  color: var(--fg);
  text-decoration: underline;
}

/* Sections */

main > section {
  margin-bottom: 3rem;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 0.5rem;
}

h2 {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 0.9rem;
}

h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1.75rem 0 0.6rem;
}

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

main ul,
main ol {
  margin: 0 0 1rem;
  padding-left: 1.3rem;
}

main li {
  margin-bottom: 0.5rem;
}

/* Home: projects and blog as a plain list; `code` items are tech names */

#projects ul,
#blog ul {
  list-style: none;
  padding: 0;
}

#projects li,
#blog li {
  margin-bottom: 1.25rem;
}

#projects li code,
#built-with code {
  font-size: 0.75rem;
  color: var(--muted);
  background: none;
  padding: 0;
  margin-right: 0.6rem;
}

/* Long-form pages: tables and diagrams */

.table {
  overflow-x: auto;
  margin: 0 0 1.25rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 0.75rem 0.5rem 0;
  border-bottom: 1px solid var(--line);
}

th {
  font-weight: 600;
  color: var(--muted);
}

.diagram {
  margin: 1.5rem 0;
  text-align: center;
}

.diagram img {
  max-width: 100%;
  height: auto;
  background: #ffffff;
  padding: 0.75rem;
  border-radius: 6px;
}

/* Placeholders the operator fills in before publishing */

.todo {
  background: var(--todo-bg);
  color: var(--todo-fg);
  padding: 0.05em 0.3em;
  border-radius: 3px;
}

/* Footer */

footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 480px) {
  html {
    font-size: 16px;
  }

  body {
    padding: 2.5rem 1rem 3rem;
  }

  .name {
    font-size: 2rem;
  }
}

/* A table with an empty header row is a label/value list (e.g. a project's links): hide the header,
   keep labels narrow and muted. */
.table thead:not(:has(th:not(:empty))) {
  display: none;
}

.table:has(thead th:first-child:empty) td:first-child {  /* :has cannot nest, so match on the empty first header cell */
  width: 1%;
  white-space: nowrap;
  color: var(--muted);
}
