/* Ground, ink, soft, hair, copper, body and the type are tokens.css's, linked
   before this file. --dim stays .5 so 11px labels keep their contrast. */
:root {
  --dim: rgba(239, 237, 229, .5);
  --circuit-idle: #315B54;
  --circuit-joint: #365E57;
  --signal-halo: #E7A665;
  --signal-core: #FFF8EA;
  /* One fixed measure shared by header, body, and signature. A ch-based value
     resolves against each element's own font size and would split the column:
     the 16px header and signature would get 597px while the 22px body got 760px. */
  --article-measure: 760px;
}

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

html {
  min-width: 320px;
  background: var(--ground);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--read);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
}

a:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 5px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  display: flex;
  justify-content: center;
  width: 100%;
  padding: max(30px, env(safe-area-inset-top)) 24px 0;
}

.site-wordmark {
  padding-left: .34em;
  color: var(--ink);
  font-family: var(--disp);
  font-size: clamp(12px, 1.05vw, 14px);
  font-weight: 400;
  letter-spacing: .34em;
  line-height: 1.4;
  text-decoration: none;
}

.site-wordmark:hover {
  color: var(--body);
}

.mono,
.index-title,
.post-node,
.post-meta,
.article-meta,
.note-label,
.note-back,
.article-return,
.clause {
  font-family: var(--mono);
  font-feature-settings: 'tnum' 1;
}

/* Blog index */
.index-shell {
  width: min(920px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(92px, 15vh, 160px) 0 max(90px, env(safe-area-inset-bottom));
}

.index-heading,
.post-list {
  width: min(760px, 100%);
  margin-inline: auto;
}

.index-title {
  color: var(--soft);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .24em;
  line-height: 1.5;
  text-transform: uppercase;
}

.post-list {
  position: relative;
  margin-top: clamp(60px, 10vh, 104px);
  list-style: none;
}

.post-list::before {
  position: absolute;
  top: 16px;
  bottom: 16px;
  left: 8px;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--circuit-joint) 15%, var(--circuit-joint) 85%, transparent);
  content: '';
}

.post-link {
  display: grid;
  grid-template-columns: 72px 120px minmax(0, 1fr);
  align-items: start;
  min-height: 106px;
  padding: 16px 0 28px;
  text-decoration: none;
}

.post-node {
  position: relative;
  z-index: 1;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: .08em;
  line-height: 1.5;
  transition: color 180ms ease;
}

.post-node::before {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin: 2px 15px 0 4px;
  border: 1px solid var(--circuit-joint);
  border-radius: 50%;
  background: var(--ground);
  box-shadow: 0 0 0 4px var(--ground);
  vertical-align: top;
  content: '';
  transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.post-meta {
  color: var(--dim);
  font-size: 11px;
  letter-spacing: .14em;
  line-height: 1.5;
  text-transform: uppercase;
}

.post-title {
  max-width: 17ch;
  margin-top: -4px;
  font-size: clamp(30px, 4.2vw, 48px);
  font-weight: 400;
  letter-spacing: -.018em;
  line-height: 1.08;
  text-wrap: balance;
  transition: color 180ms ease;
}

.post-link:hover .post-node,
.post-link:focus-visible .post-node {
  color: var(--copper);
}

.post-link:hover .post-node::before,
.post-link:focus-visible .post-node::before {
  border-color: var(--copper);
  background: var(--copper);
  box-shadow: 0 0 0 4px var(--ground), 0 0 18px rgba(221, 161, 102, .24);
}

.post-link:hover .post-title,
.post-link:focus-visible .post-title {
  color: var(--body);
}

.post-link:focus-visible {
  outline-offset: 10px;
}

/* Article */
.article-shell {
  width: min(760px, calc(100% - 48px));
  margin: 0 auto;
  padding-top: clamp(84px, 14vh, 150px);
}

.article-header,
.article-body,
.article-signature {
  width: min(var(--article-measure), 100%);
  margin-inline: auto;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: .15em;
  line-height: 1.5;
  text-transform: uppercase;
}

.article-meta .meta-node {
  width: 7px;
  height: 7px;
  border: 1px solid var(--circuit-joint);
  border-radius: 50%;
}

.article-title {
  max-width: 15ch;
  margin-top: clamp(25px, 4vh, 42px);
  font-size: clamp(42px, 6vw, 62px);
  font-weight: 400;
  letter-spacing: -.028em;
  line-height: 1.04;
  text-wrap: balance;
}

.article-body {
  margin-top: clamp(70px, 11vh, 118px);
  font-size: clamp(20px, 2.15vw, 22px);
  font-weight: 400;
  line-height: 1.64;
}

.article-body > p {
  margin-top: 1.35em;
}

.article-body > p:first-child {
  margin-top: 0;
  font-size: 1.08em;
}

.note-marker {
  position: relative;
  display: inline-block;
  margin-left: .08em;
  color: var(--copper);
  font-family: var(--mono);
  font-size: .58em;
  line-height: 1;
  text-decoration: none;
  vertical-align: super;
}

.note-marker::after {
  position: absolute;
  inset: -7px -6px;
  content: '';
}

.note-marker:hover,
.note-marker[aria-expanded='true'] {
  color: var(--signal-core);
}

.note-marker:focus-visible {
  border-radius: 2px;
  outline-offset: 3px;
}

.source-note {
  display: none;
  margin: 18px 0 28px;
  padding: 2px 0 2px 20px;
  border-left: 1px solid var(--circuit-joint);
  color: var(--soft);
  font-size: .76em;
  line-height: 1.55;
  scroll-margin-top: 24px;
}

.no-js .source-note:target,
.js .source-note.is-open {
  display: block;
}

.source-note p + p,
.source-note p + ul {
  margin-top: .72em;
}

.note-label {
  display: block;
  margin-bottom: 9px;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.source-note a:not(.note-back) {
  color: var(--ink);
  text-decoration-color: var(--hair);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.source-note a:not(.note-back):hover {
  color: var(--body);
  text-decoration-color: currentColor;
}

.source-links {
  padding-left: 1.1em;
}

.source-links li + li {
  margin-top: .45em;
}

.source-note,
.source-note a {
  overflow-wrap: anywhere;
}

.note-back {
  display: inline-block;
  margin-top: 13px;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: .13em;
  text-decoration: none;
  text-transform: uppercase;
}

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

.article-signature {
  margin-top: clamp(84px, 13vh, 132px);
  text-align: right;
}

.signature-name {
  font-size: clamp(20px, 2.6vw, 24px);
  font-style: italic;
  line-height: 1.3;
}

.signature-place {
  margin-top: 6px;
  color: var(--soft);
  font-size: 16px;
  font-style: italic;
  line-height: 1.4;
}

.article-return {
  width: min(760px, calc(100% - 48px));
  margin-top: clamp(64px, 9vh, 96px);
  color: var(--dim);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.article-return a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 0;
  text-decoration: none;
}

.article-return a:hover {
  color: var(--ink);
}

/* Legal pages: the article shell, with numbered clause labels and plain lists. */
.legal .article-title {
  max-width: none;
}

.legal .article-body {
  margin-top: clamp(48px, 8vh, 84px);
  font-size: clamp(18px, 1.9vw, 20px);
}

.clause {
  margin-top: 3em;
  color: var(--dim);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .15em;
  line-height: 1.5;
  text-transform: uppercase;
}

.legal .clause + p,
.legal .clause + ul {
  margin-top: .9em;
}

.legal .article-body > ul {
  margin-top: 1.1em;
  padding-left: 1.1em;
}

.legal li + li {
  margin-top: .5em;
}

.legal a {
  color: var(--ink);
  text-decoration-color: var(--hair);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.legal a:hover {
  color: var(--body);
  text-decoration-color: currentColor;
}

.legal-return {
  display: flex;
  justify-content: space-between;
}

.article-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: clamp(78px, 12vh, 132px) 0 max(64px, env(safe-area-inset-bottom));
}

.article-heart {
  width: clamp(320px, 38vw, 440px);
  aspect-ratio: 818 / 729;
  isolation: isolate;
}

@media (max-width: 680px) {
  .site-header {
    padding-top: max(26px, env(safe-area-inset-top));
  }

  .index-shell,
  .article-shell {
    width: calc(100% - 40px);
  }

  .index-shell {
    padding-top: clamp(78px, 13vh, 112px);
  }

  .post-link {
    grid-template-columns: 72px minmax(0, 1fr);
    row-gap: 12px;
    min-height: 128px;
  }

  .post-node {
    grid-row: 1 / span 2;
  }

  .post-meta,
  .post-title {
    grid-column: 2;
  }

  .post-title {
    max-width: 15ch;
    margin-top: 0;
    font-size: clamp(31px, 9.5vw, 43px);
  }

  .article-shell {
    padding-top: clamp(76px, 12vh, 106px);
  }

  .article-title {
    margin-top: 25px;
    font-size: clamp(38px, 11.4vw, 49px);
  }

  .article-body {
    margin-top: clamp(62px, 10vh, 88px);
    font-size: clamp(20px, 5.7vw, 21.5px);
    line-height: 1.58;
  }

  .source-note {
    margin-top: 15px;
    padding-left: 16px;
    font-size: .8em;
  }

  .article-heart {
    width: min(76vw, 310px);
  }

  .article-return {
    width: calc(100% - 40px);
    margin-top: clamp(56px, 9vh, 80px);
  }
}

@media (pointer: coarse) {
  .note-marker::after {
    inset: -9px -8px;
  }
}

@media print {
  :root {
    color-scheme: light;
    --ink: #1A1814;
    --ground: #FAF4E2;
    --soft: #4A3A20;
    --dim: #5F5A52;
    --hair: rgba(26, 24, 20, .18);
  }

  html,
  body {
    background: var(--ground);
  }

  .site-header {
    padding-top: 0;
  }

  .article-shell {
    width: auto;
    padding-top: 48pt;
  }

  .article-body {
    font-size: 12pt;
  }

  .source-note,
  .no-js .source-note,
  .js .source-note {
    display: block !important;
    break-inside: avoid;
  }

  .note-back,
  .article-return,
  .article-footer {
    display: none !important;
  }

  .source-note a::after {
    color: var(--dim);
    content: ' (' attr(href) ')';
    font-family: var(--mono);
    font-size: 8pt;
  }
}
