* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: #080808; }
html, body { overflow-x: hidden; overflow-x: clip; }
body {
  background: #080808 url("tsc-cosmic-poster.jpg") center / cover no-repeat fixed;
  color: #f2ede6;
  font-family: "Trebuchet MS", "Segoe UI", Verdana, sans-serif;
  font-size: 18px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
::selection {
  background: #e8e0d2;
  color: #080808;
}

/* Decorative night-sky backdrop: outside text flow, never intercepts input. */
.cosmic-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: #080808 url("tsc-cosmic-poster.jpg") center / cover no-repeat;
}
.cosmic-bg video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
/* Darker than sibling sites: essays are long reads. */
.cosmic-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

main {
  position: relative;
  z-index: 1;
  /* Border-box includes the side padding, so 76ch here yields ~65-68ch of
     readable line length on desktop. Mobile stays fluid and zoom-free. */
  max-width: 76ch;
  margin: 0;
  padding: 10vh 20px 64px clamp(20px, 8vw, 64px);
  text-align: left;
}

/* 2px reading-progress bar fixed to the very top. Fill only, no animation. */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 3;
  pointer-events: none;
}
.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: rgba(242, 237, 230, 0.4);
}

.site-header {
  margin: 0 0 32px;
  font-size: 15px;
}
.site-header a {
  text-decoration: none;
}
.site-header a:hover { text-decoration: underline; }

h1 {
  font-size: 30px;
  line-height: 1.25;
  font-weight: 700;
  margin: 0 0 8px;
  text-wrap: pretty;
}
article h1 { margin-bottom: 4px; }
h2 {
  font-size: 21px;
  line-height: 1.4;
  font-weight: 700;
  margin: 2.2em 0 0.6em;
  text-wrap: balance;
}
.anchor {
  color: #c9c4bb;
  text-decoration: none;
  opacity: 0;
  margin-left: 8px;
  font-weight: 400;
}
h2:hover .anchor,
h2:focus-within .anchor,
.anchor:focus-visible { opacity: 1; }
.anchor:hover { color: #f2ede6; }

p {
  font-size: 18px;
  line-height: 1.8;
  margin: 0 0 1.6em;
  text-wrap: pretty;
  text-align: left;
  hyphens: none;
  orphans: 3;
  widows: 3;
}

.essay-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.essay-list li { margin: 0 0 28px; }
.essay-list li:last-child { margin-bottom: 0; }
.essay-title {
  font-size: 20px;
  line-height: 1.4;
}
.essay-summary {
  margin: 4px 0 0;
  font-size: 15px;
  line-height: 1.7;
  color: #f2ede6;
}

.note, time.note, .meta {
  font-size: 12px;
  line-height: 1.6;
  color: #c9c4bb;
}
time { display: inline-block; }
.reading-time { margin: 4px 0 0; }

.colophon {
  color: #c9c4bb;
  font-size: 14px;
  line-height: 1;
  margin: 3em 0 1em;
}
.essay-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 15px;
  margin: 0 0 1em;
}
.essay-nav .next { margin-left: auto; }
.essay-nav:empty { display: none; }

a, a:visited {
  color: #f2ede6;
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover, a:active { color: #ffffff; }
a:focus-visible, button:focus-visible {
  outline: 2px solid #f2ede6;
  outline-offset: 3px;
}

#bg-toggle {
  position: fixed;
  right: clamp(16px, 4vw, 32px);
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 2;
  font: inherit;
  font-size: 12px;
  color: #c9c4bb;
  background: transparent;
  border: 0;
  padding: 4px 2px;
  margin: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
#bg-toggle:hover { color: #f2ede6; }

@media (max-width: 768px) {
  .cosmic-bg video { display: none; }
  main { padding-top: 8vh; }
}

@media print {
  body {
    background: #fff;
    color: #000;
  }
  .cosmic-bg, .cosmic-bg video, #bg-toggle, .progress, .anchor { display: none !important; }
  main {
    max-width: 100%;
    padding: 0;
    color: #000;
  }
  h1, h2, p, li, time { color: #000; }
  p, h1, h2 { orphans: 3; widows: 3; }
  a, a:visited { color: #000; }
}
