/* Layout: a huge wide-mono name across the top, then writing (wide, left) beside videos (narrow, right),
   one column on phones. Highlighter yellow marks what matters; ballpoint blue is only for links inside essays. */
:root {
  --paper: #ffffff;
  --ink: #151513;
  --pencil: #66655d;
  --faint: #ecebe4;
  --marker: #ffeb3b;
  --pen: #2443c4;

  --display: "Martian Mono", ui-monospace, Menlo, Consolas, monospace;
  --text: "Literata", Georgia, Cambria, "Times New Roman", serif;
  --mono: "Martian Mono", ui-monospace, Menlo, Consolas, monospace;

  --gutter: max(20px, 4.5vw);
  --mh: .45em; /* marker stroke height */
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--text);
  font-optical-sizing: auto;
  padding-block: clamp(1.5rem, 4vw, 3.25rem) 0;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
body > * { max-width: 1180px; margin-inline: auto; }
body.post > * { max-width: 44rem; }

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

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:focus-visible { outline: 2px solid var(--pen); outline-offset: 3px; }

/* ---- highlighter ---- */
.marker {
  background: linear-gradient(100deg, transparent .1em, var(--marker) .22em, var(--marker) calc(100% - .28em), transparent calc(100% - .1em))
    no-repeat 0 86% / 100% var(--mh);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
@media (prefers-reduced-motion: no-preference) {
  .draw { animation: draw .9s cubic-bezier(.3, .7, .2, 1) .15s both; }
}
@keyframes draw { from { background-size: 0 var(--mh); } }

/* titles get a marker swipe on hover */
.t {
  background: linear-gradient(var(--marker), var(--marker)) no-repeat 0 88% / 0 var(--mh);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: background-size .35s cubic-bezier(.3, .7, .2, 1);
}
a:hover .t, a:focus-visible .t, .t.marker { background-size: 100% var(--mh); }

/* ---- shared bits ---- */
.label {
  margin: 0;
  font: 700 1rem/1.2 var(--mono);
  font-stretch: 112.5%;
  letter-spacing: -.01em;
}
.count, .key {
  margin: 0;
  font: italic 400 .98rem/1.3 var(--text);
  color: var(--pencil);
  letter-spacing: 0;
}
.count { margin-left: .5em; }
.key .marker { color: var(--ink); --mh: .5em; }

.label-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem 1.5rem;
  padding-bottom: .9rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--ink);
}

.button {
  display: inline-block;
  font: 700 .75rem/1 var(--mono);
  font-stretch: 112.5%;
  color: var(--paper);
  background: var(--ink);
  padding: .75em 1.05em .7em;
  text-decoration: none;
  transition: transform .15s, box-shadow .15s, background-color .15s, color .15s;
}
.button:hover, .button:focus-visible {
  color: var(--ink);
  background: var(--marker);
  transform: translate(-2px, -2px);
  box-shadow: 3px 3px 0 var(--ink);
}

.elsewhere {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
  font: 500 .8rem/1.4 var(--mono);
}
.elsewhere a { text-decoration: none; border-bottom: 1.5px solid currentColor; }
.elsewhere a:hover { background: var(--marker); }

time, .guest, .kicker, .old-posts .meta {
  font: 400 .74rem/1.4 var(--mono);
  color: var(--pencil);
  font-variant-numeric: tabular-nums;
}

/* ---- masthead ---- */
.masthead { padding-bottom: clamp(3rem, 7vw, 5rem); }
.name {
  margin: 0;
  font: 800 clamp(2.45rem, 10.4vw, 8.6rem)/.95 var(--display);
  font-stretch: 112.5%;
  letter-spacing: -.05em;
  word-spacing: -.3em;
  --mh: .36em;
}
.name .marker { background-position: 0 80%; }

.intro {
  display: flex;
  align-items: center;
  gap: clamp(1.1rem, 3vw, 1.9rem);
  margin-top: clamp(1.4rem, 3.4vw, 2.4rem);
}
.sticker {
  flex: none;
  width: clamp(78px, 10.5vw, 122px);
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border: 4px solid var(--paper);
  outline: 1.5px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  transform: rotate(-5deg);
}
.tagline {
  margin: 0 0 .8rem;
  font: italic 400 clamp(1.4rem, 3vw, 2.1rem)/1.15 var(--text);
  letter-spacing: -.01em;
}

/* ---- homepage columns ---- */
.grid { display: grid; gap: clamp(3.5rem, 7vw, 5.5rem); }
.grid > * { min-width: 0; }
@media (min-width: 920px) {
  .grid { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; }
}

/* writing */
.posts { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.2rem; }
.posts li {
  display: grid;
  grid-template-columns: 6.6rem minmax(0, 1fr);
  column-gap: 1.25rem;
  align-items: baseline;
}
.posts a { display: block; text-decoration: none; }
.posts .t { font-size: 1.3rem; font-weight: 500; line-height: 1.22; letter-spacing: -.006em; }
.posts .s { display: block; margin-top: .2rem; font-style: italic; font-size: 1rem; line-height: 1.38; color: var(--pencil); }

#substack-posts > li:first-child {
  grid-template-columns: minmax(0, 1fr);
  row-gap: .55rem;
  padding-bottom: 1.6rem;
  margin-bottom: .5rem;
  border-bottom: 1px solid var(--faint);
}
#substack-posts > li:first-child time::before { content: "newest · "; color: var(--ink); font-weight: 600; }
#substack-posts > li:first-child .t {
  font-size: clamp(2rem, 4.6vw, 3.1rem);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -.022em;
  --mh: .4em;
}
#substack-posts > li:first-child .s { font-size: clamp(1.05rem, 1.8vw, 1.3rem); margin-top: .5rem; }

.more { margin-top: 1.9rem; }
.more summary {
  display: inline-flex;
  gap: .7em;
  cursor: pointer;
  list-style: none;
  font: 700 .75rem/1 var(--mono);
  font-stretch: 112.5%;
  padding: .8em 0 .7em;
  border-bottom: 1.5px solid var(--ink);
}
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: "+"; }
.more[open] summary::before { content: "\2212"; }
.more summary:hover { background: var(--marker); }
.more[open] summary { margin-bottom: 1.6rem; }

/* videos */
.feature .thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--ink);
}
.feature img, .feature iframe { display: block; width: 100%; height: 100%; object-fit: cover; border: 0; }
.play {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  width: 3.3rem;
  height: 3.3rem;
  background: var(--marker);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .15s, box-shadow .15s;
}
.play::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0;
  height: 0;
  border-left: 1rem solid var(--ink);
  border-block: .62rem solid transparent;
  transform: translateX(.14rem);
}
.thumb:hover .play, .thumb:focus-visible .play { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
.feature .vt { display: block; margin-top: .85rem; text-decoration: none; }
.feature .t { font-size: 1.4rem; font-weight: 600; line-height: 1.18; letter-spacing: -.01em; }
.guest { display: block; margin-top: .3rem; }

.video-list { list-style: none; margin: 1.6rem 0 0; padding: 0; display: grid; gap: 1.05rem; }
.video-list a {
  display: grid;
  grid-template-columns: 8.4rem minmax(0, 1fr);
  gap: .95rem;
  align-items: start;
  text-decoration: none;
}
.video-list img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: var(--faint); }
.video-list .t { font-size: 1.02rem; font-weight: 500; line-height: 1.27; }
.all { margin: 1.6rem 0 0; font: 700 .75rem/1 var(--mono); font-stretch: 112.5%; }

/* old blog */
.oldblog { margin-top: clamp(4.5rem, 9vw, 7rem); }
.old-posts { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.3rem 3rem; }
@media (min-width: 720px) { .old-posts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1080px) { .old-posts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.old-posts a { text-decoration: none; }
.old-posts .t { font-size: 1.14rem; font-weight: 500; line-height: 1.26; }
.old-posts .meta { display: block; margin-top: .3rem; }

/* footer */
.foot {
  margin-top: clamp(5rem, 10vw, 8rem);
  padding-block: 2.2rem 3.5rem;
  border-top: 2px solid var(--ink);
}
.foot .label { margin-bottom: .7rem; }
.email {
  display: inline-block;
  font: 800 clamp(1.15rem, 4.4vw, 2.7rem)/1.1 var(--display);
  font-stretch: 112.5%;
  letter-spacing: -.04em;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.email:hover, .email:focus-visible { background: var(--marker); }
.foot .elsewhere { margin-top: 1.5rem; }

/* ---- old blog post pages ---- */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: clamp(2.75rem, 7vw, 4.75rem);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  font: 800 1rem/1 var(--display);
  font-stretch: 112.5%;
  letter-spacing: -.04em;
  text-decoration: none;
}
.brand img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border: 2px solid var(--paper);
  outline: 1.5px solid var(--ink);
  transform: rotate(-5deg);
}
.brand:hover { background: var(--marker); }

.kicker { margin: 0 0 1rem; }
.kicker a { color: var(--pencil); }
.title {
  margin: 0 0 clamp(2rem, 4.5vw, 3rem);
  font: 650 clamp(2.1rem, 5.6vw, 3.4rem)/1.05 var(--text);
  letter-spacing: -.024em;
  text-wrap: balance;
  --mh: .4em;
}

.body { font-size: clamp(1.08rem, 1.6vw, 1.19rem); line-height: 1.72; overflow-wrap: break-word; }
.body > * { margin: 0 0 1.15em; }
.body a { color: var(--pen); }
.body a:hover { color: var(--ink); background: var(--marker); }
.body h2, .body h3, .body h4, .body h5, .body h6 { font-size: 1.24em; font-weight: 650; line-height: 1.25; margin: 2em 0 .7em; }
.body h4, .body h5, .body h6 { font-size: 1.04em; }
.body img { max-width: 100%; height: auto; }
.body img.tex { vertical-align: middle; }
.body figure { margin: 2em 0; }
.body figcaption { margin-top: .6em; font: 400 .74rem/1.45 var(--mono); color: var(--pencil); }
.body blockquote { margin-inline: 0; padding-left: 1.2em; border-left: 3px solid var(--marker); font-style: italic; }
.body pre { margin-left: 1.4em; font: italic 400 1.04em/1.7 var(--text); white-space: pre-wrap; }
.body ul, .body ol { padding-left: 1.4em; }
.body hr { border: 0; margin: 2.4em 0; text-align: center; }
.body hr::after { content: "*  *  *"; white-space: pre; color: var(--pencil); }
.body sup { line-height: 0; font: 700 .6em var(--mono); }
.body sup a { padding: .1em .3em; text-decoration: none; color: var(--ink); background: var(--faint); }
.body sup a:hover { background: var(--marker); }

.footnotes {
  margin: 3em 0 0;
  padding: 1.5em 0 0 1.3em;
  border-top: 1px solid var(--faint);
  font-size: .88em;
  line-height: 1.55;
  color: var(--pencil);
}
.footnotes li { margin-bottom: .6em; }
.footnotes .back { text-decoration: none; color: var(--ink); }

.after { margin-top: 3.5rem; padding: 1.5rem 1.6rem 1.7rem; background: var(--marker); }
.after p { margin: 0 0 1.1rem; font-size: 1.12rem; line-height: 1.4; }
.after p:last-child { margin: 0; }
.after .button:hover, .after .button:focus-visible { background: var(--paper); }

.pager { display: grid; gap: 1.4rem 2rem; margin-top: 2.75rem; }
@media (min-width: 640px) {
  .pager { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pager .newer { grid-column: 2; text-align: right; }
}
.pager a { display: block; text-decoration: none; }
.pager .dir { display: block; margin-bottom: .4rem; font: 700 .72rem/1 var(--mono); color: var(--pencil); }
.pager .t { font-size: 1.12rem; font-weight: 500; line-height: 1.3; }

.post .foot .email { font-size: clamp(1.1rem, 4vw, 1.8rem); }

.lost { padding-bottom: 4rem; }
.lost .tagline { margin: 1.5rem 0 2rem; }

/* ---- phones ---- */
@media (max-width: 600px) {
  body { font-size: 1rem; }
  .posts li { grid-template-columns: minmax(0, 1fr); row-gap: .2rem; }
  .posts .t { font-size: 1.17rem; }
  .video-list a { grid-template-columns: 7.2rem minmax(0, 1fr); }
  .bar .button { font-size: .68rem; }
}

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