/* One page, two colours. Light is the base; dark only swaps the tokens. */

:root {
  --bg: #f6f6f4;
  --fg: #16161a;
  --dim: #6b6b72;
  --line: #d8d8d3;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", "Cascadia Mono", Menlo,
    Consolas, "DejaVu Sans Mono", monospace;
}

/* System preference, unless the reader has explicitly asked for light. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101013;
    --fg: #e9e9ec;
    --dim: #8d8d96;
    --line: #2a2a30;
  }
}

/* An explicit choice wins in both directions. */
:root[data-theme="dark"] {
  --bg: #101013;
  --fg: #e9e9ec;
  --dim: #8d8d96;
  --line: #2a2a30;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.25rem;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

main {
  width: 100%;
  max-width: 34rem;
  text-align: center;
}

.avatar {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
}

h1 {
  margin: 1rem 0 0;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
}

/* centred explicitly: the `p` rule below turns prose left-aligned */
.name {
  margin: 0.15rem 0 0;
  text-align: center;
  color: var(--dim);
}

.links {
  margin-top: 0.9rem;
  color: var(--dim);
  word-spacing: 0.3ch;
}

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

p {
  margin: 0 0 0.9rem;
  text-align: left;
  text-wrap: pretty;
}

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

a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

a:hover,
a:focus-visible {
  color: var(--bg);
  background: var(--fg);
  border-bottom-color: transparent;
  outline: none;
}

/* theme switcher --------------------------------------------------------- */

.toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  padding: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--fg);
  cursor: pointer;
}

.toggle:hover,
.toggle:focus-visible {
  border-color: var(--fg);
  outline: none;
}

/* A disc that the box-shadow bites a crescent out of in dark mode. */
.toggle span {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: var(--fg);
  transition: box-shadow 0.2s, transform 0.2s;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .toggle span {
    background: transparent;
    box-shadow: inset -0.32rem -0.32rem 0 0 var(--fg);
    transform: rotate(-30deg);
  }
}

:root[data-theme="dark"] .toggle span {
  background: transparent;
  box-shadow: inset -0.32rem -0.32rem 0 0 var(--fg);
  transform: rotate(-30deg);
}

:root[data-theme="light"] .toggle span {
  background: var(--fg);
  box-shadow: none;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .toggle span {
    transition: none;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 14px;
    padding: 4rem 1.1rem 3rem;
  }
}
