:root {
  color-scheme: dark;
  --ink: #090a08;
  --ink-soft: #10120f;
  --ink-raised: #171913;
  --paper: #ddd5c3;
  --paper-strong: #f1eadb;
  --muted: #9c9789;
  --old-gold: #b8a174;
  --old-gold-bright: #d4bc86;
  --line: rgba(232, 223, 203, 0.3);
  --line-soft: rgba(232, 223, 203, 0.14);
  --shadow: rgba(0, 0, 0, 0.55);
  --serif: "Songti SC", "Noto Serif CJK SC", "STSong", Georgia, serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --content: 74rem;
  --reading: 46rem;
  --parallax-x: 0px;
  --parallax-y: 0px;
  --focus-x: 50%;
  --focus-y: 50%;
  --hero-image: url("./images/monk-by-the-sea.webp");
  --halo-search-widget-base-font-family: var(--sans);
  --halo-search-widget-base-rounded: 0.2rem;
  --halo-search-widget-base-bg-color: var(--ink);
  --halo-search-widget-primary-color: var(--old-gold);
  --halo-search-widget-muted-color: var(--muted);
  --halo-search-widget-content-color: var(--paper-strong);
  --halo-search-widget-modal-bg-color: var(--ink-soft);
  --halo-search-widget-modal-layer-color: rgba(0, 0, 0, 0.76);
  --halo-search-widget-hit-bg-color: var(--ink-raised);
  --halo-search-widget-divider-color: var(--line-soft);
  --halo-search-widget-kbd-border-color: var(--line);
  --halo-search-widget-kbd-shadow: none;
}

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

html {
  scroll-behavior: smooth;
  background: var(--ink);
}

body {
  margin: 0;
  min-width: 20rem;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body::selection,
body *::selection {
  background: var(--old-gold);
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.2em;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

button,
input,
textarea,
select {
  color: inherit;
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--old-gold-bright);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  z-index: 999;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 0.9rem;
  transform: translateY(-160%);
  background: var(--paper-strong);
  color: var(--ink);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% -20%, rgba(184, 161, 116, 0.08), transparent 35rem),
    var(--ink);
}

.site-header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(calc(100% - 3rem), var(--content));
  margin-inline: auto;
  padding-block: 1.35rem;
  border-bottom: 1px solid var(--line-soft);
}

.hero .site-header {
  position: absolute;
  inset: 0 0 auto;
  border-color: rgba(255, 248, 231, 0.2);
}

.brand {
  font-family: var(--serif);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.brand small {
  display: block;
  margin-top: 0.1rem;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  min-width: 0;
  gap: 1.15rem;
  align-items: center;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  font-size: 0.74rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.top-nav a {
  color: rgba(241, 234, 219, 0.78);
  text-decoration: none;
  transition: color 160ms ease;
}

.top-nav a:hover {
  color: var(--paper-strong);
}

.search-trigger {
  flex: 0 0 auto;
  color: rgba(241, 234, 219, 0.78);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-decoration: none;
  white-space: nowrap;
  transition: color 160ms ease;
}

.search-trigger:hover {
  color: var(--old-gold-bright);
}

.account-nav {
  display: flex;
  flex: 0 0 auto;
  gap: 0.65rem;
  align-items: center;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.account-nav::before {
  width: 1px;
  height: 1rem;
  margin-right: 0.15rem;
  content: "";
  background: var(--line);
}

.account-nav a {
  color: rgba(241, 234, 219, 0.8);
  text-decoration: none;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    background 160ms ease;
}

.account-nav a:hover {
  color: var(--paper-strong);
}

.account-nav .account-nav__primary {
  padding: 0.38rem 0.65rem;
  border: 1px solid rgba(241, 234, 219, 0.38);
  background: rgba(8, 10, 8, 0.18);
}

.account-nav .account-nav__primary:hover {
  border-color: var(--old-gold-bright);
  background: rgba(184, 161, 116, 0.12);
}

.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: 100svh;
  overflow: hidden;
  background: #10110e;
}

.hero__background {
  position: absolute;
  z-index: -4;
  inset: -3.5%;
  background-color: #181912;
  background-image:
    linear-gradient(115deg, rgba(4, 5, 4, 0.12), rgba(4, 5, 4, 0.38)),
    var(
      --hero-image,
      radial-gradient(circle at 72% 29%, rgba(201, 163, 104, 0.5), transparent 12%),
      radial-gradient(ellipse at 58% 48%, rgba(77, 94, 72, 0.86), transparent 32%),
      linear-gradient(165deg, #263229 0 23%, #111812 46%, #30281e 67%, #0d0e0b 100%)
    );
  background-position: center, var(--focus-x) var(--focus-y);
  background-repeat: no-repeat;
  background-size: cover;
  filter: saturate(0.72) brightness(0.82) contrast(1.08);
  transform: translate3d(var(--parallax-x), var(--parallax-y), 0) scale(1.06);
  transition: transform 900ms cubic-bezier(0.2, 0.7, 0, 1);
  will-change: transform;
}

.hero__veil {
  position: absolute;
  z-index: -3;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(5, 6, 5, 0.54), rgba(5, 6, 5, 0.18) 35%, rgba(5, 6, 5, 0.68)),
    radial-gradient(circle at center, transparent 26%, rgba(3, 4, 3, 0.63) 115%),
    var(--hero-overlay, rgba(4, 5, 4, 0.18));
}

.hero__veil::after {
  position: absolute;
  inset: 0;
  content: "";
  opacity: 0.18;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.28'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.hero__content {
  display: grid;
  place-items: center;
  width: min(calc(100% - 2rem), var(--content));
  margin-inline: auto;
  padding: 7.5rem 0 6.5rem;
}

.index-card {
  position: relative;
  width: min(33rem, calc(100vw - 2rem));
  max-height: calc(100svh - 10rem);
  overflow-y: auto;
  padding: clamp(1.45rem, 4vw, 2.5rem);
  border: 1px solid rgba(241, 234, 219, 0.5);
  background: rgba(8, 10, 8, 0.24);
  box-shadow: 0 2rem 6rem var(--shadow);
  backdrop-filter: blur(3px) saturate(0.8);
}

.index-card::before,
.index-card::after {
  position: absolute;
  width: 0.55rem;
  height: 0.55rem;
  content: "";
  border-color: rgba(241, 234, 219, 0.76);
}

.index-card::before {
  top: -1px;
  left: -1px;
  border-top: 2px solid;
  border-left: 2px solid;
}

.index-card::after {
  right: -1px;
  bottom: -1px;
  border-right: 2px solid;
  border-bottom: 2px solid;
}

.index-card__eyebrow {
  margin: 0 0 0.8rem;
  color: rgba(241, 234, 219, 0.7);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.index-card__title {
  max-width: 10ch;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.4rem, 8vw, 4.5rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.92;
  text-wrap: balance;
}

.index-card__subtitle {
  max-width: 30rem;
  margin: 1rem 0 1.8rem;
  color: rgba(241, 234, 219, 0.72);
  font-family: var(--serif);
  font-size: clamp(0.95rem, 2vw, 1.08rem);
}

.index-menu {
  margin: 0;
  padding: 0;
  border-bottom: 1px solid rgba(241, 234, 219, 0.28);
  list-style: none;
}

.index-menu__item {
  margin: 0;
  border-top: 1px solid rgba(241, 234, 219, 0.28);
}

.index-menu__link {
  display: grid;
  grid-template-columns: 3rem 1fr auto;
  gap: 0.8rem;
  align-items: center;
  min-height: 3rem;
  padding: 0.3rem 0.4rem;
  color: var(--paper-strong);
  text-decoration: none;
  transition:
    background 180ms ease,
    padding 180ms ease,
    color 180ms ease;
}

.index-menu__number {
  color: var(--old-gold-bright);
  font-family: var(--serif);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  transition: transform 180ms ease;
}

.index-menu__label {
  font-family: var(--serif);
  font-size: 1.02rem;
  letter-spacing: 0.06em;
}

.index-menu__arrow {
  opacity: 0;
  transform: translateX(-0.4rem);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.index-menu__link:hover,
.index-menu__link:focus-visible {
  padding-inline: 0.75rem;
  background: rgba(184, 161, 116, 0.12);
}

.index-menu__link:hover .index-menu__number,
.index-menu__link:focus-visible .index-menu__number {
  transform: translateX(0.25rem);
}

.index-menu__link:hover .index-menu__arrow,
.index-menu__link:focus-visible .index-menu__arrow {
  opacity: 1;
  transform: translateX(0);
}

.hero__footer {
  position: absolute;
  inset: auto 0 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 1.5rem;
  align-items: flex-end;
  width: min(calc(100% - 3rem), var(--content));
  margin-inline: auto;
  padding-block: 1.2rem;
  color: rgba(241, 234, 219, 0.7);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hero__footer a {
  text-decoration: none;
}

.hero__latest {
  display: grid;
  gap: 0.1rem;
  max-width: min(34rem, 70vw);
}

.hero__credit {
  align-self: end;
  max-width: 26rem;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero__latest strong {
  overflow: hidden;
  color: var(--paper-strong);
  font-family: var(--serif);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

.scroll-cue {
  display: inline-flex;
  gap: 0.6rem;
  align-items: center;
  justify-self: end;
  white-space: nowrap;
}

.scroll-cue::after {
  width: 1.8rem;
  height: 1px;
  content: "";
  background: currentColor;
  transform-origin: left;
  animation: breathe 2.2s ease-in-out infinite;
}

@keyframes breathe {
  50% {
    transform: scaleX(0.55);
    opacity: 0.45;
  }
}

.content-section,
.paper-shell {
  width: min(calc(100% - 3rem), var(--content));
  margin-inline: auto;
}

.content-section {
  padding-block: clamp(4rem, 10vw, 8rem);
}

.section-kicker {
  margin: 0 0 0.75rem;
  color: var(--old-gold);
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.section-title {
  max-width: 18ch;
  margin: 0 0 clamp(2.2rem, 6vw, 4.5rem);
  color: var(--paper-strong);
  font-family: var(--serif);
  font-size: clamp(2rem, 6vw, 4.6rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
  text-wrap: balance;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 23rem;
  align-items: stretch;
  gap: 1px;
  background: transparent;
}

.note-card {
  display: flex;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  height: 100%;
  flex-direction: column;
  padding: clamp(1.25rem, 3vw, 2rem);
  background: var(--ink-soft);
  box-shadow: inset 0 0 0 1px var(--line-soft);
  text-decoration: none;
  transition:
    background 180ms ease,
    transform 180ms ease;
}

.note-card:hover {
  z-index: 1;
  background: var(--ink-raised);
  transform: translateY(-0.25rem);
}

.note-card__meta {
  display: flex;
  min-width: 0;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.note-card__meta > span {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-card__meta time {
  flex: 0 0 auto;
}

.note-card__body {
  width: 100%;
  margin-top: auto;
  padding-top: 2.5rem;
}

.note-card h2,
.note-card h3 {
  display: -webkit-box;
  overflow: hidden;
  min-height: 2.4em;
  max-height: 2.4em;
  margin: 0;
  color: var(--paper-strong);
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  font-weight: 500;
  line-height: 1.2;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  text-wrap: balance;
}

.note-card p {
  display: -webkit-box;
  overflow: hidden;
  min-height: 4.95em;
  max-height: 4.95em;
  margin: 1rem 0 0;
  color: var(--muted);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.paper-shell {
  padding-block: clamp(1.5rem, 4vw, 3.5rem);
}

.article-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(0.9rem, 2vw, 1.4rem);
  padding: clamp(1.25rem, 3vw, 2.5rem) 0 clamp(2rem, 4vw, 3.5rem);
  border-bottom: 1px solid var(--line);
}

.article-header .section-kicker {
  margin: 0;
}

.article-header h1 {
  width: 100%;
  margin: 0;
  color: var(--paper-strong);
  font-family: var(--serif);
  font-size: clamp(2.45rem, 5vw, 5rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.08;
  overflow-wrap: anywhere;
  text-wrap: pretty;
  word-break: normal;
  writing-mode: horizontal-tb;
}

.article-header .article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.2rem;
}

.article-meta {
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.05em;
}

.article-body {
  width: min(100%, var(--reading));
  margin: clamp(2.5rem, 6vw, 5rem) auto;
  color: #cbc4b4;
  font-family: var(--serif);
  font-size: clamp(1.04rem, 1.8vw, 1.16rem);
  line-height: 1.95;
}

.article-body h2,
.article-body h3,
.article-body h4 {
  margin: 2.6em 0 0.8em;
  color: var(--paper-strong);
  font-weight: 600;
  line-height: 1.3;
  text-wrap: balance;
}

.article-body h2 {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
}

.article-body a {
  color: var(--old-gold-bright);
}

.article-body img {
  width: auto;
  max-height: 75vh;
  margin: 2.2rem auto;
  border: 1px solid var(--line-soft);
}

.article-body blockquote {
  margin: 2rem 0;
  padding: 0.4rem 0 0.4rem 1.3rem;
  border-left: 2px solid var(--old-gold);
  color: var(--paper);
  font-style: italic;
}

.article-body code {
  padding: 0.12em 0.3em;
  border: 1px solid var(--line-soft);
  border-radius: 0.2rem;
  background: #151712;
  color: #e2d9c5;
  font-family: var(--mono);
  font-size: 0.86em;
}

.article-body pre {
  overflow-x: auto;
  margin: 2rem 0;
  padding: 1.15rem;
  border: 1px solid var(--line-soft);
  background: #070806;
  box-shadow: inset 0 0 3rem rgba(0, 0, 0, 0.28);
  line-height: 1.65;
}

.article-body pre code {
  padding: 0;
  border: 0;
  background: transparent;
}

.article-body table {
  display: block;
  overflow-x: auto;
  width: 100%;
  margin: 2rem 0;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.88rem;
}

.article-body th,
.article-body td {
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line-soft);
  text-align: left;
}

.archive-list {
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.archive-list li {
  border-bottom: 1px solid var(--line-soft);
}

.archive-list a {
  display: grid;
  grid-template-columns: 8rem 1fr auto;
  gap: 1rem;
  align-items: baseline;
  padding: 1.25rem 0;
  text-decoration: none;
}

.archive-list a:hover strong {
  color: var(--old-gold-bright);
}

.archive-list time,
.archive-list small {
  color: var(--muted);
  font-size: 0.72rem;
}

.archive-list strong {
  color: var(--paper-strong);
  font-family: var(--serif);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 500;
  transition: color 160ms ease;
}

.taxonomy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
}

.taxonomy-grid a {
  display: grid;
  min-height: 10rem;
  padding: 1.4rem;
  background: var(--ink-soft);
  text-decoration: none;
}

.taxonomy-grid a:hover {
  background: var(--ink-raised);
}

.taxonomy-grid strong {
  align-self: end;
  color: var(--paper-strong);
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
}

.pagination {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line-soft);
}

.pagination a {
  color: var(--old-gold-bright);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  width: min(calc(100% - 3rem), var(--content));
  margin: 0 auto;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.site-footer a {
  color: var(--paper);
}

@media (max-width: 52rem) {
  .site-header,
  .hero__footer,
  .content-section,
  .paper-shell,
  .site-footer {
    width: min(calc(100% - 2rem), var(--content));
  }

  .site-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .header-actions {
    justify-content: space-between;
    width: 100%;
    gap: 0.8rem;
  }

  .top-nav {
    flex: 1 1 auto;
    justify-content: flex-start;
    width: 100%;
    max-width: 100%;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.2rem;
    font-size: 0.66rem;
    scrollbar-width: none;
    white-space: nowrap;
  }

  .top-nav a:nth-child(n + 3) {
    display: none;
  }

  .top-nav::-webkit-scrollbar {
    display: none;
  }

  .account-nav {
    flex: 0 0 auto;
    gap: 0.55rem;
    font-size: 0.65rem;
  }

  .account-nav .account-nav__primary {
    padding: 0.32rem 0.5rem;
  }

  .search-trigger {
    font-size: 0.65rem;
  }

  .hero__footer {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .hero__credit {
    display: none;
  }

  .hero__content {
    padding-top: 6.5rem;
  }

  .content-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: 19rem;
  }

  .note-card {
    min-height: 0;
  }

  .note-card__body {
    padding-top: 2rem;
  }

  .article-header {
    gap: 1rem;
    padding-top: 1rem;
  }

  .article-header h1 {
    font-size: clamp(2.2rem, 10vw, 3.8rem);
  }

  .archive-list a {
    grid-template-columns: 1fr auto;
  }

  .archive-list time {
    grid-column: 1 / -1;
  }
}

@media (max-width: 34rem) {
  .index-card {
    padding: 1.25rem;
    background: rgba(8, 10, 8, 0.4);
    backdrop-filter: blur(5px) saturate(0.76);
  }

  .index-card__title {
    font-size: clamp(2.6rem, 15vw, 4rem);
  }

  .index-menu__link {
    grid-template-columns: 2.25rem 1fr auto;
  }

  .hero__footer {
    align-items: flex-start;
  }

  .hero__latest {
    max-width: 72vw;
  }

  .scroll-cue span {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
    clip: rect(0 0 0 0);
  }

  .site-footer {
    flex-direction: column;
    gap: 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .hero__background {
    transform: scale(1.03);
  }
}

@media (prefers-contrast: more) {
  :root {
    --line: rgba(255, 255, 255, 0.7);
    --line-soft: rgba(255, 255, 255, 0.35);
  }

  .hero__veil {
    background: rgba(0, 0, 0, 0.68);
  }

  .index-card {
    background: rgba(0, 0, 0, 0.66);
  }
}
