:root {
  --red: #a11d1d;
  --red-deep: #7c1616;
  --ink: #161513;
  --ink-soft: #3a3630;
  --cream: #f4ede2;
  --cream-flat: #eee5d6;
  --line-on-ink: rgba(244, 237, 226, 0.24);
  --line-on-cream: rgba(22, 21, 19, 0.18);
  --footer-grey: #9c948a;

  --display: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --s1: 0.5rem;    /* 8.00px */
  --s2: 0.809rem;  /* 12.94px = s1 x phi */
  --s3: 1.309rem;  /* 20.94px = s2 x phi */
  --s4: 2.118rem;  /* 33.89px = s3 x phi */
  --s5: 3.427rem;  /* 54.83px = s4 x phi */
  --s6: 5.545rem;  /* 88.72px = s5 x phi */

  --fs-caption: 0.826rem; /* body / sqrt(phi) */
  --fs-body: 1.05rem;     /* phi^0, unchanged */
  --fs-lead: 1.336rem;    /* body x sqrt(phi) */
  --fs-h3: 1.699rem;      /* body x phi */
  --fs-h2: 2.749rem;      /* body x phi^2 */
  --fs-h1: 4.448rem;      /* body x phi^3 */

  --r: 0.15rem;
  --edge: clamp(1.25rem, 4.5vw, 4rem);
  --page: 92rem;
}

* , *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--fs-body);
  line-height: 1.65;
}

main { display: block; }

a { color: inherit; }

.wrap {
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: var(--edge);
}

.site-header {
  background: var(--cream);
  border-bottom: 0.3rem solid var(--ink);
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.32rem;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  background: transparent;
  border: 0.14rem solid var(--ink);
  border-radius: var(--r);
  cursor: pointer;
  flex: none;
}

.nav-toggle-bar {
  display: block;
  width: 1.3rem;
  height: 0.16rem;
  background: var(--ink);
  border-radius: 999px;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding-block: var(--s2);
  flex-wrap: wrap;
}

.wordmark {
  text-decoration: none;
  font-family: var(--display);
  font-weight: 900;
  font-size: var(--fs-body);
  letter-spacing: -0.01em;
  white-space: nowrap;
  text-transform: uppercase;
  color: var(--red);
}

.wordmark span { color: var(--red); }

.wordmark small {
  display: block;
  font-weight: 700;
  font-size: var(--fs-caption);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 0.3rem;
}

.site-nav ul {
  display: flex;
  gap: var(--s3);
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.site-nav a {
  text-decoration: none;
  font-size: var(--fs-caption);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding-bottom: 0.3rem;
  border-bottom: 0.18rem solid transparent;
}

.site-nav a[aria-current="page"] { border-bottom-color: var(--red); }
.site-nav a:hover, .site-nav a:focus-visible { border-bottom-color: var(--ink); }

a:focus-visible, button:focus-visible {
  outline: 0.18rem solid var(--red);
  outline-offset: 0.18rem;
}

.btn {
  display: inline-block;
  text-decoration: none;
  font-weight: 800;
  font-size: var(--fs-caption);
  letter-spacing: 0.01em;
  padding: 0.95rem 1.9rem;
  border-radius: var(--r);
  border: 0.16rem solid transparent;
  cursor: pointer;
  font-family: inherit;
}

.btn-ink-outline {
  background: transparent;
  border-color: var(--ink);
  color: var(--ink);
}

.btn-ink-outline:hover, .btn-ink-outline:focus-visible {
  background: var(--ink);
  color: var(--cream);
}

/* Used on red-background sections (homepage CTA/credibility, About action
   band) -- shared here since it now appears on 2+ pages. */
.btn-outline-cream {
  background: transparent;
  border-color: var(--cream);
  color: var(--cream);
}

.btn-outline-cream:hover, .btn-outline-cream:focus-visible {
  background: var(--cream);
  color: var(--ink);
}

.site-footer {
  background: var(--ink);
  border-top: 0.14rem solid var(--ink);
  padding-block: var(--s4);
}

.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s3);
  flex-wrap: wrap;
}

.footer-nav ul {
  display: flex;
  gap: var(--s2);
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: nowrap;
}

.footer-nav a {
  text-decoration: none;
  font-size: var(--fs-caption);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--cream);
}

.footer-nav a:hover, .footer-nav a:focus-visible {
  text-decoration: underline;
  text-decoration-color: var(--red);
}

.footer-meta {
  font-size: var(--fs-caption);
  color: var(--footer-grey);
  line-height: 1.75;
  text-align: right;
}

.footer-meta a { color: var(--cream); text-decoration: underline; text-decoration-color: var(--red); }

.site-nav button.contact-trigger {
  display: inline-block;
  background: none;
  border: none;
  border-bottom: 0.18rem solid transparent;
  padding: 0 0 0.3rem;
  margin: 0;
  font: inherit;
  text-decoration: none;
  font-size: var(--fs-caption);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: inherit;
  cursor: pointer;
}

.site-nav button.contact-trigger:hover, .site-nav button.contact-trigger:focus-visible {
  border-bottom-color: var(--ink);
}

.footer-nav button.contact-trigger {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  text-decoration: none;
  font-size: var(--fs-caption);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--cream);
  cursor: pointer;
}

.footer-nav button.contact-trigger:hover, .footer-nav button.contact-trigger:focus-visible {
  text-decoration: underline;
  text-decoration-color: var(--red);
}

.btn-red {
  background: var(--red);
  color: var(--cream);
}

.btn-red:hover, .btn-red:focus-visible { background: var(--red-deep); }

/* ---------------- Contact modal (native <dialog>, Web3Forms) ---------------- */

.kicker {
  display: block;
  margin-bottom: var(--s2);
  font-size: var(--fs-caption);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red);
}

.contact-modal {
  width: min(30rem, calc(100vw - 2 * var(--edge)));
  max-height: min(40rem, 94dvh);
  margin: auto;
  border: none;
  border-radius: var(--r);
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  overflow: auto;
}

.contact-modal::backdrop {
  background: rgba(22, 21, 19, 0.6);
}

.contact-modal-inner {
  /* padding-block : padding-inline = phi : 1 (1.309rem : 0.809rem), kept compact
     so the whole form fits in one view without scrolling on common viewports. */
  padding: 1.309rem 0.809rem;
  position: relative;
}

.contact-modal-close {
  position: absolute;
  top: var(--s2);
  right: var(--s2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  background: transparent;
  border: 0.14rem solid var(--ink);
  border-radius: var(--r);
  font-size: var(--fs-lead);
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
}

.contact-modal-close:hover, .contact-modal-close:focus-visible {
  background: var(--ink);
  color: var(--cream);
}

.contact-modal-head { margin: 0 0 0.809rem; padding-right: 3rem; }

.contact-modal-head .kicker { margin-bottom: 0.5rem; }

.contact-modal-head h2 {
  margin: 0 0 0.5rem;
  font-family: var(--display);
  font-weight: 900;
  font-size: var(--fs-h3);
  letter-spacing: -0.02em;
}

.contact-modal-notice {
  margin: 0.6rem 0 0;
  font-size: var(--fs-caption);
  line-height: 1.5;
  color: var(--ink-soft);
}

.contact-form { display: flex; flex-direction: column; gap: 0.809rem; }

.contact-field { display: flex; flex-direction: column; gap: 0.309rem; }

.contact-field span {
  font-weight: 700;
  font-size: var(--fs-caption);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.contact-field input, .contact-field textarea {
  font-family: var(--body);
  font-size: var(--fs-body);
  color: var(--ink);
  background: var(--cream-flat);
  border: 0.1rem solid var(--ink-soft);
  border-radius: var(--r);
  padding: 0.5rem 0.75rem;
  resize: vertical;
}

.contact-field textarea { min-height: 4.5rem; }

.contact-field input:focus-visible, .contact-field textarea:focus-visible {
  outline: 0.14rem solid var(--red);
  outline-offset: 0.1rem;
  border-color: var(--red);
}

.contact-form-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.contact-form-actions {
  display: flex;
  align-items: center;
  gap: 0.809rem;
  flex-wrap: wrap;
}

.contact-form-error {
  font-size: var(--fs-caption);
  color: var(--red);
}

.contact-form-success {
  margin: 0;
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--ink-soft);
}

@media (prefers-reduced-motion: no-preference) {
  .contact-modal {
    transition: opacity 0.2s ease, transform 0.2s ease, overlay 0.2s ease allow-discrete, display 0.2s ease allow-discrete;
    opacity: 0;
    transform: translateY(0.6rem);
  }

  .contact-modal[open] {
    opacity: 1;
    transform: translateY(0);
  }

  @starting-style {
    .contact-modal[open] {
      opacity: 0;
      transform: translateY(0.6rem);
    }
  }

  .contact-modal::backdrop {
    transition: background-color 0.2s ease, overlay 0.2s ease allow-discrete, display 0.2s ease allow-discrete;
    background: rgba(22, 21, 19, 0);
  }

  .contact-modal[open]::backdrop {
    background: rgba(22, 21, 19, 0.6);
  }

  @starting-style {
    .contact-modal[open]::backdrop {
      background: rgba(22, 21, 19, 0);
    }
  }
}

@media (max-width: 30rem) {
  .contact-modal-inner { padding: 1.309rem 0.809rem; }
}

@media (max-width: 68rem) {
  .nav-toggle { display: inline-flex; }
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--cream);
    border-bottom: 0.3rem solid var(--ink);
    padding: var(--s3) var(--edge) var(--s4);
  }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; gap: var(--s2); }
  .site-nav a { display: block; padding-block: 0.4rem; }
  .site-footer .wrap { flex-direction: column; }
  .footer-meta { text-align: left; }
}

.article {
  padding-top: var(--s5);
  padding-bottom: var(--s6);
}

.article-head {
  max-width: 46rem;
  margin-inline: auto;
  padding-inline: var(--edge);
}

.article-head h1 {
  margin: 0 0 var(--s3);
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(2rem, 3.8vw, var(--fs-h1));
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.byline-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55em;
  margin-bottom: var(--s3);
  font-size: var(--fs-caption);
  color: var(--ink-soft);
}

.byline-datetime span + span::before {
  content: "\00b7";
  margin-inline: 0.55em;
  color: var(--ink-soft);
}

.byline-sep { color: var(--ink-soft); }

.byline-name {
  font-weight: 800;
  color: var(--ink);
}

.article-head-rule {
  padding-top: var(--s3);
  border-top: 0.14rem solid var(--ink);
}

/* ---------------- Article actions bar (share, read time, save) ---------------- */

.article-actions {
  max-width: 44rem;
  margin: var(--s1) auto 0;
  padding-inline: var(--edge);
  padding-block: var(--s1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s3);
}

.article-actions-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s3);
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: inherit;
  font-size: var(--fs-caption);
  font-weight: 700;
  text-decoration: none;
  color: var(--ink-soft);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.action-btn svg {
  width: 1.1rem;
  height: 1.1rem;
  flex: none;
}

.action-btn:hover, .action-btn:focus-visible {
  color: var(--red);
}

.share-menu-wrap {
  position: relative;
}

.share-btn[aria-expanded="true"] {
  color: var(--red);
}

.share-menu {
  position: absolute;
  top: calc(100% + 0.6rem);
  left: 0;
  z-index: 30;
  min-width: 11rem;
  background: var(--cream-flat);
  border: 0.1rem solid var(--line-on-cream);
  border-radius: var(--r);
  padding: 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.share-menu[hidden] {
  display: none;
}

.share-menu-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: var(--fs-caption);
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
  background: none;
  border: none;
  border-radius: var(--r);
  padding: 0.55rem 0.65rem;
  cursor: pointer;
}

.share-menu-item svg {
  width: 1.05rem;
  height: 1.05rem;
  flex: none;
  color: var(--ink-soft);
}

.share-menu-item:hover, .share-menu-item:focus-visible {
  background: var(--cream);
  color: var(--red);
}

.share-menu-item:hover svg, .share-menu-item:focus-visible svg {
  color: var(--red);
}

@media (max-width: 30rem) {
  .article-actions { flex-direction: column; align-items: flex-start; }
}

.article-body {
  max-width: 44rem;
  margin-inline: auto;
  padding-inline: var(--edge);
  padding-top: var(--s4);
  font-size: var(--fs-lead);
  line-height: 1.7;
  color: var(--ink);
}

.article-body p {
  margin: 0 0 var(--s3);
}

.article-body a {
  color: var(--red);
  text-decoration-color: var(--red);
}

.article-body strong { font-weight: 800; }

/* Sits between the article body and the black rule: article content ->
   this bar -> black line -> related block. */
.article-actions-bottom {
  margin-top: var(--s5);
}

/* Built exactly like .article-head / .article-head-rule (a padded 46rem
   outer box containing an unpadded rule div), not like .article-actions's
   own 44rem box, so this line renders at the identical pixel width and
   position as the rule under the byline, true symmetry rather than just
   a matching border-width number. */
.article-foot-rule-wrap {
  max-width: 46rem;
  margin: var(--s3) auto 0;
  padding-inline: var(--edge);
}

.article-foot-rule {
  padding-top: var(--s3);
  border-top: 0.14rem solid var(--ink);
}

.related-block {
  max-width: 44rem;
  margin: 0 auto;
  padding-inline: var(--edge);
  padding-top: var(--s3);
}

.related-label {
  margin: 0 0 var(--s2);
  font-family: var(--display);
  font-weight: 800;
  font-size: var(--fs-caption);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.related-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.related-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s2);
  padding-block: 0.85rem;
  border-bottom: 0.08rem solid var(--line-on-cream);
}

.related-row a {
  text-decoration: none;
  font-weight: 800;
  font-size: var(--fs-body);
  letter-spacing: -0.005em;
  min-width: 0;
}

.related-row a:hover, .related-row a:focus-visible {
  text-decoration: underline;
  text-decoration-color: var(--red);
  text-decoration-thickness: 0.12rem;
}

.related-row .related-date {
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-caption);
  color: var(--ink-soft);
  white-space: nowrap;
  flex: none;
}

@media (max-width: 68rem) {
  .article-body { font-size: 1.222rem; }
}

@media (max-width: 30rem) {
  .related-row { flex-direction: column; align-items: flex-start; gap: 0.2rem; }
}

.print-footer { display: none; }

/* "Save as PDF" is the browser's own print engine (window.print()), so
   what shows here is exactly what ends up in the saved file: article only,
   no header, no action bars, no footer, no page chrome. */
@media print {
  @page { margin: 2cm; }

  .site-header, .article-actions, .site-footer, .related-block { display: none; }

  body { background: #fff; color: #000; }

  .article { padding: 0; }

  .article-head, .article-body, .print-footer {
    max-width: 100%;
    padding-inline: 0;
  }

  .kicker, .article-head h1, .byline-name { color: #000; }

  .article-body { font-size: 12pt; line-height: 1.5; color: #000; }

  .article-body a, .bio-intro a { color: #000; text-decoration: underline; }

  .print-footer {
    display: block;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 0.5pt solid #999;
    font-size: 9pt;
    color: #555;
  }
}

/* ---------------- Numbered index row ----------------
   Shared by the homepage's Recent Writing preview and the Writing archive
   pages -- identical on both. .index-list itself and .pagination are NOT
   shared (each page's own <style> block has its own): the homepage's list
   sits inside a 12-column grid and needs grid-column: 1 / span 12, and its
   pagination has no divider rule, while the archive page's pagination gets
   a bold border-top -- two intentionally different treatments, not a
   duplication to collapse. */

.index-row {
  display: grid;
  grid-template-columns: 3.5rem 6rem 1fr;
  gap: var(--s3);
  padding-block: var(--s3);
  border-top: 0.1rem solid var(--line-on-cream);
  align-items: start;
}

.index-list li:last-child .index-row { border-bottom: 0.1rem solid var(--line-on-cream); }

.index-num {
  font-family: var(--display);
  font-weight: 900;
  font-size: var(--fs-h3);
  color: var(--red);
  letter-spacing: -0.02em;
}

.index-date {
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-caption);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  padding-top: 0.35rem;
}

.index-body a { text-decoration: none; }

.index-body h3 {
  margin: 0 0 0.35rem;
  font-size: var(--fs-lead);
  font-weight: 800;
  letter-spacing: -0.01em;
  max-width: 65%;
}

.index-body p {
  margin: 0;
  color: var(--ink-soft);
  font-size: var(--fs-body);
  max-width: 56ch;
}

.index-body a:hover h3, .index-body a:focus-visible h3 {
  text-decoration: underline;
  text-decoration-color: var(--red);
  text-decoration-thickness: 0.14rem;
}

/* Base layout only -- shared. Each page's own <style> block adds its own
   spacing/divider treatment on top (.pagination { ... } again, additively):
   the Writing archive gets padding-top + a bold border-top divider; the
   homepage's embedded preview gets grid-column + margin-top and no divider,
   since it already sits among other section rules. */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--s2);
}

.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  height: 2.4rem;
  padding-inline: 0.6rem;
  font-weight: 800;
  font-size: 0.92rem;
  text-decoration: none;
  color: var(--ink);
  border: 0.12rem solid var(--ink);
  border-radius: var(--r);
}

.pagination a:hover, .pagination a:focus-visible {
  background: var(--ink);
  color: var(--cream);
}

.pagination .current {
  background: var(--red);
  border-color: var(--red);
  color: var(--cream);
}

.pagination .prev-next {
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding-inline: 1rem;
}

.pagination .disabled {
  color: var(--footer-grey);
  border-color: var(--line-on-cream);
  cursor: default;
}

.pagination .ellipsis {
  border: none;
  color: var(--ink-soft);
  min-width: 1.2rem;
}

@media (max-width: 68rem) {
  .index-row { grid-template-columns: 2.5rem 1fr; }
  .index-date { grid-column: 2; padding-top: 0; order: -1; }
  .index-body { grid-column: 2; }
  .index-body h3 { max-width: 100%; }
}
