/* Colors. Text is black; the Substack blue is the accent. */
:root {
  --paper: #FFFFF6;
  --ink: #111111;
  --muted: #62625C;
  --rule: #E5E5DA;
  --accent: #110EA8;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0B0A3F;
    --ink: #FFFFF6;
    --muted: #A6A5D3;
    --rule: #25236B;
    --accent: #FFFFF6;
  }
}

:root[data-theme="dark"] {
  --paper: #0B0A3F;
  --ink: #FFFFF6;
  --muted: #A6A5D3;
  --rule: #25236B;
  --accent: #FFFFF6;
}

* { box-sizing: border-box; margin: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font: 400 18px/1.75 Lora, Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration-color: currentColor;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

p { margin-bottom: 1.15rem; }

/* Layout: name and contact on the left, the letter centered, obsessions on the right */
.page {
  display: grid;
  /* Equal side columns keep the letter centered */
  grid-template-columns: 15rem minmax(0, 34rem) 15rem;
  grid-template-areas:
    ".    top  .   "
    "side main note";
  column-gap: 4rem;
  justify-content: center;
  padding: 5rem 16px 6rem;
}

.top { grid-area: top; }
main { grid-area: main; }

.side {
  grid-area: side;
  align-self: start;
  position: sticky;
  top: 2rem;
  padding-top: .35rem;
  text-align: right;
}

.name {
  font: 500 20px/1.3 Lora, Georgia, serif;
  margin-bottom: 2rem;
}

.label {
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .2rem;
}

.email { font-size: 16px; margin-bottom: .2rem; white-space: nowrap; }

/* Theme toggle: a small switch, knob slides right in dark mode */
.top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 4rem;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
  cursor: pointer;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.track {
  position: absolute;
  inset: 0;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--paper);
}

.track::before {
  content: "";
  position: absolute;
  left: 2px;
  bottom: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
}

.toggle.ready .track::before { transition: transform .2s; }

.toggle input:checked + .track::before { transform: translateX(20px); }

.toggle input:focus-visible + .track {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

blockquote {
  margin: -.4rem 0 1.15rem;
  padding-left: 1.1rem;
  border-left: 2px solid var(--accent);
  font-style: italic;
}

main ul {
  list-style: none;
  padding: 0;
  margin: -.4rem 0 1.15rem;
}

main li {
  position: relative;
  padding-left: 1.1rem;
}

main li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: var(--muted);
}

/* Obsessions: the site's one memorable element, level with the name. */
.note {
  grid-area: note;
  align-self: start;
  padding-top: .35rem;
  font-size: 15px;
  line-height: 1.5;
}

.note .label {
  line-height: 31px; /* puts its baseline level with the name's */
  margin-bottom: 0;
}

.note .current {
  font-size: 18px;
  color: var(--accent);
}

.note summary {
  list-style: none;
  cursor: pointer;
  margin-top: .3rem;
  color: var(--muted);
  font-size: 13px;
}

.note summary::-webkit-details-marker { display: none; }

.note summary .mono {
  color: var(--accent);
  text-decoration: none;
}

.note summary .mono:hover { text-decoration: underline; }

.note summary .more {
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
}

.note summary:hover .more { color: var(--ink); }

.note ol {
  padding: 0;
  margin-top: .7rem;
}

.note li {
  list-style: none;
  position: relative;
  margin-left: 4px; /* the dots straddle the line */
  padding: 0 0 .7rem .9rem;
  border-left: 1px solid var(--rule);
}

.note li::before {
  content: "";
  position: absolute;
  left: -4px;
  top: .5em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--muted);
}

.note li:first-child::before {
  background: var(--accent);
  border-color: var(--accent);
}

.note .meta {
  color: var(--muted);
  font-size: 12px;
}

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

.note .meta a:hover { color: var(--accent); }

.mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .82em;
}

.updated {
  margin-top: 2rem;
  font-size: 13px;
  color: var(--muted);
}

/* Easter egg: the old terminal site */
.cli {
  position: fixed;
  right: 16px;
  bottom: 12px;
  font: 12px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--muted);
  text-decoration: none;
  opacity: .6;
}

.cli:hover {
  color: var(--accent);
  opacity: 1;
}

/* Medium windows: no room for both side columns, so the obsessions move under
   the letter and the left rail stays (and keeps sticking). */
@media (max-width: 1180px) {
  .page {
    grid-template-columns: 15rem minmax(0, 34rem);
    grid-template-areas:
      ".    top "
      "side main"
      ".    note";
    column-gap: 3rem;
  }

  .note {
    padding: 0;
    margin-top: 3rem;
  }
}

/* Small windows: one column, rail on top. */
@media (max-width: 760px) {
  .page {
    grid-template-columns: minmax(0, 34rem);
    grid-template-areas: "side" "note" "main";
    padding-top: 2.5rem;
  }

  /* Toggle shares the name's row */
  .top {
    grid-area: side;
    justify-self: end;
    align-self: start;
    margin: .3rem 0 0;
  }

  .side {
    position: static;
    padding: 0;
    text-align: left;
    margin-bottom: 3rem;
  }

  .name { margin-bottom: 1rem; }

  .note {
    margin: 0 0 3rem;
  }
}
