:root {
  --paper: #f7eddf;
  --paper-light: #fffaf2;
  --ink: #211a15;
  --ink-soft: #665d55;
  --ink-faint: #a59a8f;
  --line: #29221d;
  --line-soft: rgba(41, 34, 29, 0.18);
  --coral: #e8755d;
  --yellow: #f0c84b;
  --teal: #196277;
  --sage: #879b7a;
  --radius: 0.7rem;
  --page-width: 118rem;
  --ease: cubic-bezier(0.2, 0.75, 0.25, 1);
}

html {
  scroll-padding-top: 8rem;
}

body {
  background: var(--paper);
  color: var(--ink);
}

body,
.navigation a,
.navigation button {
  font-family: "LXGW WenKai", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.wrapper {
  min-height: 100vh;
}

#content {
  min-height: calc(100vh - 15rem);
}

a {
  color: inherit;
}

/* Global navigation */
.navigation {
  position: relative;
  z-index: 20;
  width: 100%;
  max-width: none;
  height: 8rem;
  margin: 0;
  padding: 0 3.2rem;
  border-bottom: 0.3rem solid var(--line);
  background: var(--paper-light);
}

.navigation .container {
  display: flex;
  width: 100%;
  max-width: 150rem;
  height: 100%;
  margin: 0 auto;
  padding: 0;
  align-items: center;
  justify-content: space-between;
}

.navigation .navigation-brand {
  display: inline-flex;
  float: none;
  align-items: center;
  gap: 1.1rem;
  padding: 0;
  color: var(--ink);
  text-decoration: none;
}

.navigation-brand > span {
  display: grid;
  width: 4.5rem;
  height: 4.5rem;
  border: 0.25rem solid var(--line);
  border-radius: 50%;
  place-items: center;
  background: var(--yellow);
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.navigation-brand strong {
  font-size: 2.3rem;
  font-weight: 800;
  letter-spacing: 0;
}

.navigation .navigation-list {
  display: flex;
  float: none;
  height: 100%;
  margin: 0;
  align-items: center;
  gap: 0.5rem;
}

.navigation .navigation-list .navigation-item {
  display: flex;
  float: none;
  height: 100%;
  margin: 0;
  align-items: center;
}

.navigation .navigation-list .navigation-menu a {
  display: inline-flex;
  min-height: 4.4rem;
  padding: 0 1.5rem;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  font-size: 1.6rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 180ms var(--ease), color 180ms var(--ease);
}

.navigation .navigation-list .navigation-menu a:hover,
.navigation .navigation-list .navigation-menu a:focus-visible,
.navigation .navigation-list .navigation-menu a.is-active {
  background: var(--ink);
  color: var(--paper-light);
}

.navigation .navigation-social {
  margin-left: 1rem !important;
}

.navigation .navigation-social a {
  display: grid;
  width: 4.4rem;
  height: 4.4rem;
  padding: 0 !important;
  place-items: center;
  color: var(--ink);
}

.navigation .navigation-dark {
  padding: 0 !important;
}

.navigation .navigation-dark button {
  display: grid;
  width: 4.4rem;
  height: 4.4rem;
  padding: 0;
  border: 0;
  place-items: center;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 2rem;
}

/* Shared editorial shell */
.editorial-page {
  width: 100%;
  background: var(--paper);
  color: var(--ink);
}

.editorial-hero,
.section-hero {
  position: relative;
  overflow: hidden;
  border-bottom: 0.3rem solid var(--line);
}

.editorial-hero {
  min-height: 56rem;
  padding: 8rem max(3.2rem, calc((100vw - var(--page-width)) / 2));
  display: grid;
  place-items: center;
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 100rem;
  text-align: center;
}

.eyebrow {
  margin: 0 0 2.4rem;
  color: var(--ink-soft);
  font-family: SFMono-Regular, Consolas, monospace;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.editorial-hero h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(4.8rem, 6vw, 8.8rem);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: 0;
  text-wrap: balance;
}

.editorial-hero h1 em {
  position: relative;
  font-style: normal;
  white-space: nowrap;
}

.editorial-hero h1 em::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: 0;
  bottom: 0.1em;
  left: 0;
  height: 0.1em;
  border-radius: 50%;
  background: var(--coral);
  transform: rotate(-1deg);
}

.hero-description {
  max-width: 64rem;
  margin: 3rem auto 0;
  color: var(--ink-soft);
  font-size: 1.8rem;
  line-height: 1.8;
  text-wrap: pretty;
}

.category-pills {
  display: flex;
  margin-top: 4rem;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.category-pills a {
  display: inline-flex;
  min-height: 4.8rem;
  padding: 0 2rem;
  border: 0.2rem solid var(--line);
  border-radius: 999px;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  background: transparent;
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform 180ms var(--ease), background 180ms var(--ease), color 180ms var(--ease);
}

.category-pills a:hover,
.category-pills a:focus-visible,
.category-pills a.is-active {
  background: var(--ink);
  color: var(--paper-light);
  text-decoration: none;
  transform: translateY(-0.2rem);
}

.category-pills small {
  opacity: 0.62;
  font-family: SFMono-Regular, Consolas, monospace;
  font-size: 1.1rem;
}

.hero-mark {
  position: absolute;
  left: max(3rem, calc((100vw - 145rem) / 2));
  bottom: 4rem;
  display: grid;
  grid-template-columns: repeat(4, 0.7rem);
  gap: 1.2rem;
  opacity: 0.45;
}

.hero-mark span {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--ink-soft);
}

/* Section headers */
.section-hero {
  min-height: 32rem;
  padding: 6rem max(3.2rem, calc((100vw - var(--page-width)) / 2));
}

.section-hero h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(5rem, 8vw, 9rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.section-hero > p:not(.eyebrow) {
  max-width: 60rem;
  margin: 2.4rem 0 0;
  color: var(--ink-soft);
  font-size: 1.8rem;
  line-height: 1.8;
  text-wrap: pretty;
}

.section-count {
  position: absolute;
  right: max(3.2rem, calc((100vw - var(--page-width)) / 2));
  bottom: 5rem;
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

.section-count strong {
  font-family: Georgia, serif;
  font-size: 7rem;
  font-weight: 400;
  line-height: 1;
}

.section-count span {
  color: var(--ink-soft);
  font-size: 1.4rem;
}

/* Timeline */
.archive-section {
  width: min(var(--page-width), calc(100% - 6.4rem));
  margin: 0 auto;
  padding: 7rem 0 10rem;
}

.archive-heading {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 2.4rem;
  margin-bottom: 4rem;
  text-align: center;
}

.archive-heading::before,
.archive-heading::after {
  content: "";
  height: 1px;
  background: repeating-linear-gradient(to right, var(--ink-faint) 0 0.4rem, transparent 0.4rem 0.8rem);
}

.archive-heading span {
  display: none;
}

.archive-heading h2 {
  grid-column: 2;
  margin: 0;
  color: var(--ink);
  font-size: 3.8rem;
  line-height: 1;
}

.archive-heading p {
  grid-column: 1 / -1;
  margin: -1rem 0 0;
  color: var(--ink-soft);
  font-size: 1.4rem;
}

.timeline-year + .timeline-year {
  margin-top: 6rem;
}

.year-heading {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 2.4rem;
  margin-bottom: 3rem;
}

.year-heading span {
  height: 1px;
  background: repeating-linear-gradient(to right, var(--ink-faint) 0 0.4rem, transparent 0.4rem 0.8rem);
}

.year-heading h2,
.year-heading h3 {
  margin: 0;
  color: var(--ink);
  font-family: SFMono-Regular, Consolas, monospace;
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1;
}

.timeline-items {
  position: relative;
  width: min(98rem, calc(100% - 4rem));
  margin: 0 auto;
}

.timeline-items::before {
  content: "";
  position: absolute;
  top: 1.9rem;
  bottom: 2rem;
  left: 1.3rem;
  border-left: 0.2rem dashed var(--line-soft);
}

.timeline-entry {
  position: relative;
  padding-left: 5rem;
}

.timeline-entry + .timeline-entry {
  margin-top: 1.2rem;
}

.timeline-dot {
  position: absolute;
  z-index: 2;
  top: 1.1rem;
  left: 0;
  width: 2.8rem;
  height: 2.8rem;
  border: 0.3rem solid var(--line);
  border-radius: 50%;
  background: var(--teal);
}

.entry-life .timeline-dot {
  background: var(--coral);
}

.entry-study .timeline-dot {
  background: var(--yellow);
}

.entry-works .timeline-dot {
  background: var(--teal);
}

.timeline-link {
  position: relative;
  display: block;
  min-height: 17rem;
  padding: 0.6rem 1rem 3.2rem;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
  text-decoration: none;
  transition: transform 180ms var(--ease);
}

.timeline-link:hover,
.timeline-link:focus-visible {
  color: var(--ink);
  text-decoration: none;
  transform: translateX(0.5rem);
}

.entry-meta {
  display: flex;
  min-height: 3.2rem;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--ink-faint);
  font-family: SFMono-Regular, Consolas, monospace;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.entry-meta time,
.entry-meta .entry-undated {
  color: var(--ink-soft);
  font-size: 1.3rem;
  font-weight: 800;
}

.entry-meta > span:not(.entry-type):not(.entry-undated)::before {
  content: "·";
  margin-right: 1rem;
}

.entry-type {
  padding: 0.1rem 0.9rem;
  border: 0.15rem solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(240, 200, 75, 0.24);
  font-family: "LXGW WenKai", sans-serif;
  font-weight: 700;
  letter-spacing: 0;
}

.entry-life .entry-type {
  background: rgba(232, 117, 93, 0.18);
}

.entry-works .entry-type {
  background: rgba(25, 98, 119, 0.15);
}

.entry-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3rem;
  align-items: start;
}

.entry-content h3 {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 1.1rem 0 0.8rem;
  color: var(--ink);
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: 0;
  text-wrap: pretty;
}

.timeline-link:hover .entry-content h3::after,
.timeline-link:focus-visible .entry-content h3::after {
  transform: scaleX(1);
}

.entry-content h3::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -0.2rem;
  left: 0;
  height: 0.25rem;
  border-radius: 50%;
  background: var(--coral);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 220ms var(--ease);
}

.entry-content p {
  max-width: 72rem;
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.55rem;
  line-height: 1.8;
  text-wrap: pretty;
}

.entry-cover {
  width: 15rem;
  aspect-ratio: 16 / 10;
  margin: 1.2rem 0 0;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--paper-light);
}

.entry-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.8);
  transition: transform 300ms var(--ease), filter 300ms var(--ease);
}

.timeline-link:hover .entry-cover img {
  transform: scale(1.04);
  filter: saturate(1);
}

.entry-tags {
  display: flex;
  margin-top: 1.4rem;
  flex-wrap: wrap;
  gap: 1.2rem;
}

.entry-tags span {
  color: var(--ink-faint);
  font-family: SFMono-Regular, Consolas, monospace;
  font-size: 1.1rem;
}

.entry-open {
  position: absolute;
  right: 1rem;
  bottom: 2.7rem;
  color: var(--ink);
  font-size: 1.3rem;
  font-weight: 800;
}

.empty-state {
  padding: 5rem 0;
  color: var(--ink-soft);
  text-align: center;
}

.page-nav {
  display: grid;
  width: min(var(--page-width), calc(100% - 6.4rem));
  margin: -4rem auto 8rem;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  color: var(--ink-soft);
  font-size: 1.4rem;
}

.page-nav > :last-child {
  justify-self: end;
}

.page-nav a {
  font-weight: 700;
}

/* Detail pages and footer */
.blog,
.work-detail {
  color: var(--ink);
}

.work-title {
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--line-soft);
}

.work-description {
  max-width: 60rem;
  color: var(--ink-soft);
}

.work-detail-meta {
  display: flex;
  margin-top: 1.5rem;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.work-detail-meta span {
  padding: 0.2rem 0.8rem;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 1.2rem;
}

.work-actions {
  display: flex;
  margin-top: 2rem;
  gap: 1rem;
}

.work-actions a {
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.work-hero {
  width: 100%;
  margin: 3rem 0;
  border-radius: var(--radius);
}

.site-footer {
  height: auto;
  margin: 0;
  padding: 3rem 3.2rem;
  border-top: 0.2rem solid var(--line);
  background: var(--paper-light);
}

.footer-inner {
  display: flex;
  width: 100%;
  max-width: var(--page-width);
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.footer-inner nav {
  display: flex;
  gap: 1.5rem;
}

.footer-inner p {
  margin: 0;
}

/* Keep the reference palette coherent in the theme's dark mode. */
[data-dark-mode] {
  --paper: #201b17;
  --paper-light: #29231e;
  --ink: #f4eadc;
  --ink-soft: #c4b8aa;
  --ink-faint: #8f8479;
  --line: #f0e4d5;
  --line-soft: rgba(240, 228, 213, 0.18);
  --coral: #ef856e;
  --yellow: #e6bf49;
  --teal: #4f9caf;
}

[data-dark-mode] body,
[data-dark-mode] .editorial-page {
  background: var(--paper);
}

@media only screen and (max-width: 900px) {
  .navigation {
    height: 7rem;
    padding: 0 2rem;
  }

  .navigation .navigation-brand {
    position: relative;
    z-index: 7;
  }

  .navigation-brand > span {
    width: 4rem;
    height: 4rem;
  }

  .navigation .menu-button {
    position: relative;
    z-index: 7;
    display: grid;
    width: 4.4rem;
    height: 4.4rem;
    margin: 0;
    place-content: center;
    gap: 0.5rem;
    cursor: pointer;
  }

  .navigation .menu-button span {
    display: block;
    width: 2rem;
    height: 0.2rem;
    margin: 0;
    background: var(--ink);
  }

  .navigation .navigation-list {
    position: absolute;
    top: 6.7rem;
    right: 0;
    left: 0;
    display: grid;
    visibility: hidden;
    height: auto;
    max-height: 0;
    padding: 1.6rem 2rem 2rem;
    overflow: hidden;
    border-top: 0;
    border-bottom: 0.3rem solid var(--line);
    background: var(--paper-light);
    opacity: 0;
    transition: max-height 220ms var(--ease), opacity 180ms ease;
  }

  .navigation #menu-toggle:checked + .menu-button + .navigation-list {
    visibility: visible;
    max-height: 55rem;
    opacity: 1;
  }

  .navigation .navigation-list .navigation-item {
    width: 100%;
    height: auto;
    justify-content: center;
  }

  .navigation .navigation-list .navigation-menu a {
    width: 100%;
    min-height: 4.8rem;
  }

  .navigation .navigation-social {
    margin-left: 0 !important;
  }

  .editorial-hero {
    min-height: 50rem;
    padding: 6rem 3.2rem;
  }

  .editorial-hero h1 {
    font-size: clamp(4.2rem, 9vw, 6.8rem);
  }

  .section-count {
    position: static;
    margin-top: 3rem;
  }
}

@media only screen and (max-width: 640px) {
  .navigation-brand strong {
    font-size: 2rem;
  }

  .editorial-hero {
    min-height: calc(100svh - 7rem);
    padding: 5rem 2rem 6rem;
  }

  .editorial-hero h1 {
    font-size: clamp(3.8rem, 12vw, 5.4rem);
    line-height: 1.2;
  }

  .editorial-hero h1 br {
    display: none;
  }

  .editorial-hero h1 em {
    white-space: normal;
  }

  .hero-description {
    font-size: 1.6rem;
  }

  .category-pills {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .category-pills a {
    padding: 0 1.2rem;
    justify-content: center;
  }

  .hero-mark {
    display: none;
  }

  .section-hero {
    min-height: 29rem;
    padding: 4.5rem 2rem;
  }

  .section-hero h1 {
    font-size: 5.2rem;
  }

  .section-count strong {
    font-size: 5rem;
  }

  .archive-section {
    width: calc(100% - 4rem);
    padding: 5rem 0 7rem;
  }

  .archive-heading {
    gap: 1.4rem;
  }

  .archive-heading h2 {
    font-size: 3rem;
  }

  .year-heading {
    gap: 1.4rem;
  }

  .year-heading h2,
  .year-heading h3 {
    font-size: 2.6rem;
  }

  .timeline-items {
    width: 100%;
  }

  .timeline-items::before {
    left: 0.9rem;
  }

  .timeline-entry {
    padding-left: 3.6rem;
  }

  .timeline-dot {
    top: 1.2rem;
    width: 2rem;
    height: 2rem;
    border-width: 0.25rem;
  }

  .timeline-link {
    min-height: 0;
    padding: 0.4rem 0 5.8rem;
  }

  .timeline-link:hover,
  .timeline-link:focus-visible {
    transform: none;
  }

  .entry-content {
    display: block;
  }

  .entry-content h3 {
    font-size: 2.3rem;
  }

  .entry-content p {
    font-size: 1.45rem;
  }

  .entry-cover {
    width: 100%;
    margin-top: 1.6rem;
  }

  .entry-open {
    right: 0;
    bottom: 2.2rem;
  }

  .page-nav {
    width: calc(100% - 4rem);
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

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