/* h1.title::before { content: "❧"; } */

/* === Remove link hover shift behavior === */
@media (hover: hover) and (pointer: fine) {
  :not(.logo) > a:hover {
    position: static;
    inset: auto;
  }
}

/* === Writing index === */

.blog:not(.single) {
  --writing-width: 44rem;
}

/* The homepage name is also the h-card's canonical URL. It remains the same
 * piece of display type rather than acquiring link decoration or hover motion. */
.home-self-link,
.home-self-link:is(:hover, :focus-visible) {
  border: 0;
  color: inherit;
  text-decoration: none;
}

.home-self-link:focus-visible {
  outline: 1px solid var(--site-focus, #173f51);
  outline-offset: 0.16em;
}

.blog:not(.single) :is(.writing-opening, .main) {
  width: min(100%, var(--writing-width));
  margin-right: auto;
  margin-left: auto;
}

.blog:not(.single) .writing-opening {
  margin-top: clamp(2.15rem, 4vw, 2.85rem);
}

.blog:not(.single) .writing-title {
  position: relative;
  margin: 0;
  isolation: isolate;
  color: var(--site-heading, #173d31);
  font-size: clamp(2.4rem, 4.5vw, 2.9rem);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1;
}

.blog:not(.single) .writing-title::before {
  content: none;
}

.writing-title-ornament {
  position: absolute;
  z-index: -1;
  top: -2.55rem;
  left: -1.15rem;
  color: var(--site-ornament, #6f3b3f);
  font-size: 9.4rem;
  font-style: normal;
  font-weight: 400;
  line-height: 0.75;
  opacity: 0.075;
  pointer-events: none;
  transform: rotate(-1.5deg);
  -webkit-user-select: none;
  user-select: none;
}

.blog:not(.single) .main {
  flex-grow: 1;
  hyphens: none;
}

.writing-register {
  margin: 2.35rem 0 0;
  padding: 0;
  list-style: none;
}

.writing-entry {
  margin: 0;
}

.writing-entry-link {
  position: relative;
  display: block;
  padding: 0.72rem 0 0.34rem;
  border: 0;
  color: var(--site-ink, #1d1b19);
  text-decoration: none;
}

.writing-entry-link:is(:hover, :focus-visible) {
  color: var(--site-ink, #1d1b19);
}

.writing-entry-link:focus-visible {
  outline: 1px solid color-mix(in srgb, var(--site-focus, #173f51) 52%, transparent);
  outline-offset: 0.36rem;
}

.writing-entry-title {
  display: block;
  max-width: 38ch;
  color: var(--site-heading, #173d31);
  font-size: clamp(1.42rem, 2.1vw, 1.62rem);
  font-style: italic;
  line-height: 1.16;
  text-decoration: none;
  transition: color 140ms ease;
}

.writing-entry-description {
  display: block;
  max-width: 58ch;
  margin-top: 0.48rem;
  color: var(--site-muted, rgba(24, 56, 47, 0.63));
  font-size: 0.98rem;
  line-height: 1.43;
  transition: color 120ms ease;
}

.writing-date {
  display: block;
  margin-top: 0.58rem;
  color: var(--site-muted, rgba(24, 56, 47, 0.63));
  font-family: Jost, sans-serif;
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.075em;
  line-height: 1.35;
}

.writing-entry-registration {
  position: relative;
  display: block;
  height: 0.72rem;
  margin-top: 0.82rem;
  color: color-mix(in srgb, var(--site-rule-strong, #294c41) 56%, transparent);
  background:
    linear-gradient(
        90deg,
        currentColor 0%,
        color-mix(in srgb, currentColor 64%, transparent) 68%,
        transparent 100%
      )
      0.58rem calc(100% - 0.06rem) /
      calc(100% - 0.58rem) 1px no-repeat;
  pointer-events: none;
  transition: color 150ms ease;
}

.writing-entry-registration::after {
  content: "";
  position: absolute;
  bottom: 0.06rem;
  left: 0;
  width: 0.58rem;
  height: 0.52rem;
  background:
    linear-gradient(
        0deg,
        currentColor 0%,
        color-mix(in srgb, currentColor 68%, transparent) 58%,
        transparent 100%
      )
      0 0 / 1px 100% no-repeat,
    linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
}

.writing-entry-link:is(:hover, :focus-visible) .writing-entry-title {
  color: color-mix(
    in srgb,
    var(--site-heading, #173d31) 76%,
    var(--site-ink, #1d1b19) 24%
  );
}

.writing-entry-link:is(:hover, :focus-visible) .writing-entry-description {
  color: color-mix(
    in srgb,
    var(--site-muted, rgba(24, 56, 47, 0.63)) 72%,
    var(--site-ink, #1d1b19) 28%
  );
}

.writing-entry-link:is(:hover, :focus-visible) .writing-entry-registration {
  color: color-mix(in srgb, var(--site-rule-strong, #294c41) 68%, transparent);
}

@media screen and (max-width: 519px) {
  .blog:not(.single) .writing-opening {
    margin-top: 1.9rem;
  }

  .writing-title-ornament {
    top: -2.15rem;
    left: -0.75rem;
    font-size: 8rem;
  }

  .writing-register {
    margin-top: 1.95rem;
  }

  .writing-entry-link {
    padding-top: 0.64rem;
  }

  .writing-entry-description {
    max-width: 34rem;
    font-size: 0.95rem;
  }
}

/* === Single Post Improvements === */

/* Article meta container - controls title/subtitle/date group */
.single .article-meta {
  margin-top: 2rem;
  margin-bottom: 0.6rem;
}

/* Keep single-post heading rhythm aligned with home/docs pages */
.single h1.title {
  margin-top: 1em;
  margin-bottom: 0.1rem;
  position: relative;
}

/* Keep floral mark scale consistent with list/home pages */
.single h1.title::before {
  font-size: 8.9em;
  inset: auto;
  top: -0.42em;
  left: -0.14em;
  line-height: 1;
}

/* Subtitle styling */
.single .subtitle {
  margin-top: 0.2rem;
  margin-bottom: 0.5rem;
  opacity: 0.82;
}

/* Meta-line (date + categories/tags) */
.single .meta-line {
  margin-top: 0.3rem;
  margin-bottom: 1.35rem;
  opacity: 0.72;
  justify-content: flex-start;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.2rem 0.8rem;
}

.single .meta-primary {
  display: inline-flex;
  align-items: baseline;
  gap: 0.2em;
}

.single .meta-primary .date {
  opacity: 0.72;
}

.single .meta-group {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25em;
  font-size: 0.88em;
  opacity: 0.82;
}

.single .meta-label {
  text-transform: lowercase;
  letter-spacing: 0.04em;
  opacity: 0.58;
}

.single .meta-sep {
  opacity: 0.45;
}

/* Unboxed categories/tags with subtle baseline */
.single .meta-group a {
  color: inherit;
  border-bottom: 1px dotted rgba(90, 80, 66, 0.28);
  padding: 0;
  background: transparent;
  opacity: 0.88;
}

.single .meta-group a:hover {
  border-bottom-color: currentColor;
  opacity: 1;
}

/* Better content padding from borders */
.single .main {
  padding-top: 0;
}

/* Add some breathing room from the crop marks/borders */
@media (min-width: 768px) {
  .single .article-meta {
    margin-top: 2rem;
  }
}

/* === Home Page === */
.home {
  --home-ledger-width: 51rem;
}

.home-frontispiece {
  display: grid;
  width: min(100%, var(--home-ledger-width));
  margin-top: 2.2rem;
  grid-template-columns: minmax(0, 31rem) 2.75rem minmax(15rem, 17.25rem);
  align-items: start;
  hyphens: none;
}

.home-identity {
  position: relative;
  z-index: 1;
  grid-column: 1;
  isolation: isolate;
}

.home h1.title {
  margin: 0;
  color: var(--site-heading, #173d31);
  font-size: clamp(3rem, 5vw, 3.35rem);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 0.94;
}

.home h1.title::before {
  content: none;
}

.home-title-ornament {
  position: absolute;
  z-index: -1;
  top: -3.6rem;
  left: -1.2rem;
  color: var(--site-ornament, #6f3b3f);
  font-size: clamp(11.7rem, 13.4vw, 13rem);
  font-style: normal;
  font-weight: 400;
  line-height: 0.75;
  opacity: 0.09;
  pointer-events: none;
  transform: rotate(-1.5deg);
  -webkit-user-select: none;
  user-select: none;
}

.home-proposition {
  max-width: 30rem;
  margin: 1.55rem 0 0;
  font-size: 1.28rem;
  line-height: 1.32;
}

.home-affiliation {
  max-width: 29rem;
  margin: 0.9rem 0 0;
  color: var(--site-muted, rgba(24, 56, 47, 0.63));
  font-size: 0.94rem;
  line-height: 1.43;
}

.home-links {
  margin: 0.78rem 0 0;
  font-family: Jost, sans-serif;
  font-size: 0.67rem;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.home-links a {
  border-bottom: 1px solid color-mix(in srgb, var(--site-link, #173f51) 42%, transparent);
  text-decoration: none;
}

.profile-burn {
  position: relative;
  grid-column: 3;
  margin: 0.4rem 0 0;
  isolation: isolate;
}

@media screen and (min-width: 768px) {
  .profile-burn {
    margin-top: 0;
  }
}

/* Burnt-in veil so the portrait feels fused with the page */
.profile-burn::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    radial-gradient(90% 70% at 18% 12%, rgba(255, 245, 222, 0.24), rgba(255, 245, 222, 0) 68%),
    linear-gradient(142deg, rgba(248, 228, 188, 0.12) 0%, rgba(246, 233, 210, 0.05) 48%, rgba(70, 48, 28, 0.1) 100%);
  mix-blend-mode: soft-light;
  opacity: 0.34;
  transition: opacity 1.6s ease-in-out;
}

.profile-burn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(90% 70% at 18% 12%, rgba(222, 174, 106, 0.15), rgba(222, 174, 106, 0) 68%),
    linear-gradient(142deg, rgba(164, 111, 60, 0.14) 0%, rgba(112, 78, 46, 0.08) 48%, rgba(17, 12, 8, 0.28) 100%);
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 1.6s ease-in-out;
}

.profile-image {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 0;
  opacity: 0.98;
  filter: saturate(1.08) contrast(1.06) brightness(1.02) sepia(0.02);
  mix-blend-mode: normal;
  transition: opacity 1.6s ease-in-out, filter 1.6s ease-in-out;
  -webkit-mask-image: radial-gradient(140% 118% at 50% 50%, #000 82%, rgba(0, 0, 0, 0.9) 88%, rgba(0, 0, 0, 0.35) 96%, transparent 100%);
  mask-image: radial-gradient(140% 118% at 50% 50%, #000 82%, rgba(0, 0, 0, 0.9) 88%, rgba(0, 0, 0, 0.35) 96%, transparent 100%);
}

body.sunset .profile-image {
  mix-blend-mode: normal;
  opacity: 0.93;
  filter: saturate(1.03) contrast(1.06) brightness(0.98) sepia(0.04);
}

body.sunset .profile-burn::before {
  opacity: 0;
}

body.sunset .profile-burn::after {
  opacity: 0.24;
}

.publications {
  /* Leave a deliberate instrument margin at the ledger's right edge. The
   * frontispiece keeps its wider portrait composition; only the element that
   * launches the exterior readout gives that readout the room it needs. */
  max-width: var(--home-ledger-width);
  margin-top: 2.9rem;
}

.site-search {
  margin-top: 1.8rem;
}

.site-search label {
  display: block;
  margin-bottom: 0.4rem;
  color: #173d31;
  font-family: Jost, sans-serif;
  font-size: 0.76rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.site-search input {
  width: 100%;
  padding: 0.42rem 0 0.34rem;
  border: 0;
  border-bottom: 1px solid rgba(83, 76, 95, 0.42);
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 1.08rem;
}

.site-search input:focus {
  border-bottom-color: #173f51;
  box-shadow: 0 1px 0 rgba(23, 63, 81, 0.22);
}

.site-search-status {
  min-height: 1.4em;
  margin: 0.42rem 0 1.1rem;
  color: rgba(32, 38, 34, 0.58);
  font-family: Jost, sans-serif;
}

.site-search-results {
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-search-results > li {
  position: relative;
  margin: 0 0 1.15rem;
  padding-left: 1rem;
}

.site-search-results > li::before {
  position: absolute;
  top: 0.78rem;
  left: 0;
  width: 0.58rem;
  border-top: 1px solid rgba(111, 59, 63, 0.58);
  content: "";
}

.site-search-results h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: normal;
}

.site-search-preview {
  margin: 0.18rem 0 0;
  color: rgba(32, 38, 34, 0.66);
  font-size: 0.9rem;
  line-height: 1.45;
}

.publications h2 {
  margin: 0 0 0.48rem;
  color: var(--site-heading, #173d31);
  font-size: 1.55rem;
  font-style: italic;
  font-weight: 400;
  line-height: 1.05;
}

.publications ul {
  margin: 0;
  padding: 0;
  border: 0;
  background-image: linear-gradient(
    90deg,
    var(--site-rule, rgba(24, 56, 47, 0.28)) 0%,
    color-mix(in srgb, var(--site-rule, rgba(24, 56, 47, 0.28)) 82%, transparent) 76%,
    transparent 100%
  );
  background-repeat: no-repeat;
  background-position: 0 0;
  background-size: 100% 1px;
  list-style: none;
  hyphens: none;
}

.publications li {
  margin: 0;
  background-image: linear-gradient(
    90deg,
    color-mix(in srgb, var(--site-rule, rgba(24, 56, 47, 0.28)) 58%, transparent) 0%,
    color-mix(in srgb, var(--site-rule, rgba(24, 56, 47, 0.28)) 42%, transparent) 76%,
    transparent 100%
  );
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 1px;
}

.publications .publication-row {
  display: grid;
  grid-template-columns: 2.7rem 0.9rem minmax(0, 1fr);
  gap: 0.52rem;
  align-items: baseline;
  margin-inline: -0.34rem;
  padding: 0.43rem 0.34rem 0.46rem;
  border: 0;
  color: var(--site-ink, #1d1b19);
  text-decoration: none;
  transition: color 120ms ease, background-color 120ms ease;
}

.publications .publication-row:is(:hover, :focus-visible) {
  color: var(--palette-bg-main, #fbf7f0);
  background-color: var(--site-link, #173f51);
  position: static;
  inset: auto;
  outline: 0;
}

.publications .publication-row:focus-visible {
  outline: 1px solid var(--site-focus, #173f51);
  outline-offset: -1px;
  box-shadow: 0 0 0 2px var(--site-focus-accent, rgba(23, 63, 81, 0.22));
}

html[data-ink] body.is-home .home .publications .publication-row:focus-visible {
  color: var(--palette-bg-main, #fbf7f0);
}

.publications .publication-row:is(:hover, :focus-visible) :is(.publication-year, .publication-mark, .publication-collaborators) {
  color: inherit;
}

.publication-mark {
  color: var(--site-ornament, #6f3b3f);
  font-family: "Zapf Dingbats", "Segoe UI Symbol", "Noto Sans Symbols 2", "Arial Unicode MS", sans-serif;
  font-size: 0.98rem;
  font-style: normal;
  font-weight: 400;
  line-height: 1;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

.publication-body {
  min-width: 0;
  max-width: calc(100% - clamp(0rem, 5vw, 3.5rem));
}

.publication-title {
  display: block;
  font-size: 0.96rem;
  line-height: 1.2;
}

.publication-year {
  color: var(--site-muted, rgba(24, 56, 47, 0.63));
  font-family: Jost, sans-serif;
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.125em;
  line-height: 1.35;
  text-transform: uppercase;
}

.publication-collaborators {
  display: block;
  margin-top: 0.1rem;
  color: var(--site-muted, rgba(24, 56, 47, 0.63));
  font-size: 0.69rem;
  font-style: italic;
  line-height: 1.2;
}

@media screen and (max-width: 991px) {
  .home-frontispiece {
    width: 100%;
  }
}

@media screen and (max-width: 767px) {
  .home-frontispiece {
    display: block;
    margin-top: 1.35rem;
  }

  .home-title-ornament {
    top: -2.75rem;
    left: -0.8rem;
    font-size: clamp(9.5rem, 39vw, 10.7rem);
  }

  .home h1.title {
    max-width: 15rem;
    font-size: clamp(3rem, 14vw, 3.85rem);
  }

  .home-proposition {
    max-width: 31rem;
    margin-top: 1.4rem;
    font-size: 1.24rem;
  }

  .home-affiliation {
    max-width: 31rem;
  }

  .profile-burn {
    width: min(100%, 18.2rem);
    margin: 2.05rem auto 0;
  }

  .publications {
    margin-top: 2.75rem;
  }

  .publications .publication-row {
    grid-template-columns: 2.45rem 0.82rem minmax(0, 1fr);
    gap: 0.48rem;
    margin-inline: -0.28rem;
    padding: 0.7rem 0.28rem 0.72rem;
  }

  .publication-body {
    max-width: none;
  }
}

@media screen and (max-width: 440px) {
  .home h1.title {
    max-width: 6.5ch;
  }

  .publication-title {
    font-size: 0.93rem;
  }
}

@media (forced-colors: active) {
  .writing-entry-link:is(:hover, :focus-visible),
  .publications .publication-row:is(:hover, :focus-visible) {
    outline: 2px solid Highlight;
    outline-offset: -2px;
    background: Highlight;
    color: HighlightText;
    box-shadow: none;
  }

  .writing-entry-registration {
    color: CanvasText;
  }

  .writing-entry-link:is(:hover, :focus-visible) .writing-entry-registration {
    color: HighlightText;
  }
}

@media (prefers-reduced-motion: reduce) {
  .writing-entry-link,
  .writing-entry-title,
  .writing-entry-description,
  .home .profile-image,
  .home .profile-burn::before,
  .home .profile-burn::after,
  .home .publication-row {
    transition-duration: 0.01ms;
  }
}

@media print {
  .writing-entry {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .home :is(.profile-burn, .publications li) {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .home .profile-image {
    opacity: 1;
    filter: none;
  }

  .home .profile-burn::before,
  .home .profile-burn::after {
    display: none;
  }
}
