/* Writing list and post pages. Header, footer, and tokens come from styles.css. */

:root {
  --serif: Georgia, "Times New Roman", Times, serif;
  --dash: repeating-linear-gradient(to bottom, rgba(17, 19, 19, 0.38) 0 4px, transparent 4px 8px);
  --dash-x: repeating-linear-gradient(to right, rgba(17, 19, 19, 0.38) 0 4px, transparent 4px 8px);
}

.writing-main {
  flex: 1;
  width: min(680px, calc(100% - 48px));
  margin-inline: auto;
  padding-block: clamp(48px, 10svh, 112px) 80px;
}

/* List: dates sit left of a dashed vertical timeline, with a dashed tick into each post. */
.writing-list {
  --date-col: 7rem;
  width: min(820px, calc(100% - 48px));
}

.timeline {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--date-col);
  width: 1px;
  background: var(--dash);
  content: "";
}

.timeline-item + .timeline-item {
  margin-top: 40px;
}

.timeline-item a {
  position: relative;
  display: block;
  padding-left: calc(var(--date-col) + 56px);
  color: inherit;
  text-decoration: none;
}

.timeline-item a::before {
  position: absolute;
  top: 0.7rem;
  left: var(--date-col);
  width: 44px;
  height: 1px;
  background: var(--dash-x);
  content: "";
}

.timeline-item .timeline-date {
  position: absolute;
  top: 0.18rem;
  left: 0;
  width: calc(var(--date-col) - 18px);
  text-align: right;
}

.timeline-header {
  margin-bottom: 6px;
}

/* The one-line summary is optional; a title-only entry needs no gap below it. */
.timeline-header:last-child {
  margin-bottom: 0;
}

.timeline-title {
  color: #2b2d2d;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
  transition: opacity 200ms ease;
}

.timeline-date,
.post-meta {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.timeline-desc {
  margin: 0;
  color: rgba(17, 19, 19, 0.56);
  font-family: var(--serif);
  font-size: 0.92rem;
  line-height: 1.55;
}

.timeline-item a:hover .timeline-title,
.timeline-item a:focus-visible .timeline-title {
  opacity: 0.6;
}

/* Post */
.post-header {
  padding-bottom: 32px;
  border-bottom: 1px solid var(--faint);
}

.post-header h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 2.6rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.post-description {
  margin: 16px 0 0;
  color: rgba(17, 19, 19, 0.62);
  font-family: var(--serif);
  font-size: 1.1rem;
  line-height: 1.55;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin: 20px 0 0;
  font-size: 0.9rem;
}

.post-body {
  margin-top: 32px;
  color: #232525;
  font-family: var(--serif);
  font-size: 1.07rem;
  line-height: 1.75;
}

.post-body h2 {
  margin: 56px 0 14px;
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.3;
}

.post-body h3 {
  margin: 32px 0 8px;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.4;
}

.post-callout {
  padding: 4px 0 4px 20px;
  border-left: 2px solid var(--rose);
  font-size: 1.2rem;
  font-style: italic;
  line-height: 1.55;
}

.post-body a.cite {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78em;
  text-decoration: none;
  white-space: nowrap;
}

.post-body a.cite:hover,
.post-body a.cite:focus-visible {
  color: var(--accent);
}

.references {
  margin: 0;
  padding: 0;
  color: rgba(17, 19, 19, 0.7);
  font-size: 0.85rem;
  line-height: 1.6;
  list-style: none;
}

.references li {
  position: relative;
  padding-left: 2.6rem;
}

.references li + li {
  margin-top: 10px;
}

.references .ref-label {
  position: absolute;
  left: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.85em;
}

.references a {
  overflow-wrap: anywhere;
}

.references li:target {
  background: rgba(23, 65, 63, 0.06);
}

.references-section h2 {
  font-size: 1.1rem;
}

/* Table 1 figures, shown in the reference list and in its citation card. */
.ref-figures {
  display: grid;
  gap: 2px;
  margin: 8px 0;
  font-variant-numeric: tabular-nums;
}

.ref-figures div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 0;
  border-bottom: 1px dotted var(--faint);
}

.ref-figures dt,
.ref-figures dd {
  margin: 0;
}

.ref-figures .ref-total {
  border-bottom: 0;
  font-weight: 700;
}

.ref-sources {
  display: block;
  color: var(--muted);
}

/* Citation cards (writing.js). With the script running, the list at the end is replaced by
   cards on each marker. */
.has-cite-cards .references-section {
  display: none;
}

.has-cite-cards .post-body a.cite {
  /* Pad the hover highlight without shifting the surrounding punctuation. */
  margin: 0 -2px;
  padding: 0 2px;
  border-radius: 3px;
  cursor: pointer;
}

.has-cite-cards .post-body a.cite:hover,
.has-cite-cards .post-body a.cite:focus-visible,
.has-cite-cards .post-body a.cite[aria-describedby] {
  background: rgba(23, 65, 63, 0.1);
  color: var(--accent);
}

.cite-card {
  position: absolute;
  z-index: 20;
  width: min(380px, calc(100vw - 24px));
  padding: 12px 14px;
  border: 1px solid var(--ink);
  background: var(--paper);
  box-shadow: 6px 6px 0 rgba(17, 19, 19, 0.08);
  color: rgba(17, 19, 19, 0.82);
  font-family: var(--serif);
  font-size: 0.84rem;
  line-height: 1.55;
}

.cite-card[hidden] {
  display: none;
}

.cite-card-hint {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-align: right;
}

.cite-card-hint:not(:empty) {
  margin-top: 8px;
}

.cite-card a {
  color: var(--accent);
  text-decoration-color: rgba(23, 65, 63, 0.32);
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

.cite-copy-buffer {
  position: fixed;
  top: 0;
  left: -9999px;
  opacity: 0;
}

.post-body [id] {
  scroll-margin-top: 24px;
}

.post-body p,
.post-body ul,
.post-body ol {
  margin: 0 0 20px;
}

.post-body a {
  color: var(--accent);
  text-decoration-color: rgba(23, 65, 63, 0.32);
  text-underline-offset: 3px;
}

@media (max-width: 720px) {
  .writing-main {
    width: calc(100% - 40px);
  }

  .timeline::before,
  .timeline-item a::before {
    display: none;
  }

  .timeline-item a {
    padding-left: 0;
  }

  .timeline-item .timeline-date {
    position: static;
    display: block;
    width: auto;
    margin-bottom: 4px;
    text-align: left;
  }
}
