:root {
  --bg: #fbfbfa;
  --fg: #1b1b1a;
  --fg-muted: #42423f;
  --fg-subtle: #85857f;
  --line: #ebebe8;
  --underline: #cfcfca;
  --topo: 27 27 26;
  --avatar-filter: grayscale(1) contrast(1.05) brightness(1.03);

  --font: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  color-scheme: light;
}

/* ---------------------------------------------------------------- dark */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e0e;
    --fg: #ececea;
    --fg-muted: #b3b3af;
    --fg-subtle: #7c7c78;
    --line: #222221;
    --underline: #3d3d3b;
    --topo: 236 236 234;
    --avatar-filter: grayscale(1) contrast(1.1) brightness(0.82);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e0e0e;
  --fg: #ececea;
  --fg-muted: #b3b3af;
  --fg-subtle: #7c7c78;
  --line: #222221;
  --underline: #3d3d3b;
  --topo: 236 236 234;
  --avatar-filter: grayscale(1) contrast(1.1) brightness(0.82);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg-muted);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.2s ease, color 0.2s ease;
}

::selection {
  background: var(--fg);
  color: var(--bg);
}

/* Background: a random topographic map, faded toward the center */
#topo {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 60% 90% at 50% 50%, transparent 45%, #000 100%);
  mask-image: radial-gradient(ellipse 60% 90% at 50% 50%, transparent 45%, #000 100%);
}

.wrap {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 1rem;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 3.5rem 0 0;
}

nav {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  margin-right: -0.5rem;
}

/* Photo + name in the header. Photo is black & white, color on hover */
.me {
  display: inline-flex;
  align-items: center;
  gap: 0.875rem;
  min-width: 0;
  border: 0;
}

.me img {
  display: block;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--line);
  filter: var(--avatar-filter);
  transition: filter 0.5s ease;
}

.me:hover img {
  filter: none;
}

.me-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}

.me-name {
  color: var(--fg);
  font-weight: 500;
}

.me-role {
  overflow: hidden;
  color: var(--fg-subtle);
  font-size: 0.8125rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: 0.5rem;
  background: none;
  color: var(--fg-subtle);
  cursor: pointer;
  transition: color 0.2s ease;
}

.icon:hover {
  color: var(--fg);
}

.i-sun {
  display: none;
}

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

:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }

main {
  flex: 1;
  padding: 4rem 0 3rem;
}

h1 {
  margin: 0 0 1.75rem;
  color: var(--fg);
  font-size: 1.875rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

/* Section label followed by a hairline */
h2 {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 3.5rem 0 0.5rem;
  color: var(--fg-subtle);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--underline);
  transition: border-color 0.2s ease;
}

a:hover {
  border-color: var(--fg);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Rows: company · role · dates */
.rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rows li {
  display: grid;
  grid-template-columns: 21ch 1fr auto;
  align-items: baseline;
  column-gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--fg);
}

.rows li:last-child {
  border-bottom: 0;
}

.rows li > :first-child {
  justify-self: start;
}

.rows .role {
  color: var(--fg-subtle);
}

.rows .date {
  color: var(--fg-subtle);
  font-size: 0.875em;
  line-height: 1;
  white-space: nowrap;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem 0 2.5rem;
  color: var(--fg-subtle);
  font-size: 0.8125rem;
}

@media (max-width: 560px) {
  header {
    gap: 0.5rem;
    padding-top: 1.75rem;
  }

  .me {
    gap: 0.75rem;
  }

  .me-role {
    font-size: 0.75rem;
    white-space: normal;
  }

  .icon {
    width: 2rem;
  }

  main {
    padding-top: 2.75rem;
  }

  h1 {
    font-size: 1.625rem;
  }

  .rows li {
    grid-template-columns: 1fr auto;
    row-gap: 0.125rem;
  }

  .rows .role {
    grid-column: 1 / -1;
    grid-row: 2;
    font-size: 0.9375em;
  }

  #topo {
    -webkit-mask-image: linear-gradient(to bottom, #000 0, transparent 35%);
    mask-image: linear-gradient(to bottom, #000 0, transparent 35%);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
