/* Standalone atlas entries and directory. Served directly; no app CSS or JS required. */
@font-face {
  font-family: "Fraunces Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/fonts/fraunces-soft-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Manrope Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("/fonts/manrope-latin.woff2") format("woff2");
}

.profile-page {
  --profile-paper: #f3f0e9;
  --profile-raised: #faf7f3;
  --profile-ink: #28211b;
  --profile-muted: #61584e;
  --profile-line: #d0c8bc;
  --profile-accent: #934b36;
  --profile-navy: #294b61;
  --profile-serif:
    "Fraunces Variable", "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
  --profile-sans:
    "Manrope Variable", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC",
    "Microsoft YaHei", system-ui, sans-serif;
  margin: 0;
  min-width: 0;
  min-height: 100vh;
  background: var(--profile-paper);
  color: var(--profile-ink);
  font-family: var(--profile-sans);
  font-size: 1rem;
  line-height: 1.75;
  overflow-wrap: anywhere;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

.profile-page :where(h1, h2, h3, h4, p, ul, ol, dl, dd) {
  margin: 0;
}

.profile-page :where(h1, h2, h3, h4) {
  font-family: var(--profile-serif);
  font-weight: 550;
  line-height: 1.2;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.profile-page h1 {
  font-size: clamp(2.25rem, 6vw, 4rem);
}

.profile-page h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.profile-page h3 {
  font-size: 1.25rem;
}

.profile-page :lang(zh):where(h1, h2, h3, h4),
.profile-page:lang(zh) :where(h1, h2, h3, h4) {
  letter-spacing: 0;
  line-height: 1.4;
}

.profile-page :where(p, li, dd) {
  text-wrap: pretty;
}

.profile-page :where(ul, ol) {
  padding-inline-start: 1.25rem;
}

.profile-page li + li {
  margin-block-start: 0.5rem;
}

.profile-page a {
  color: var(--profile-navy);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

.profile-page a:hover {
  color: var(--profile-accent);
}

.profile-page a:focus-visible {
  outline: 2px solid var(--profile-navy);
  outline-offset: 3px;
  border-radius: 3px;
}

.profile-page a[href] {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  max-width: 100%;
  padding-block: 0.25rem;
}

.profile-header,
.profile-container,
.profile-footer {
  width: calc(100% - 3rem);
  max-width: 70rem;
  margin-inline: auto;
}

.profile-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1rem;
  border-bottom: 1px solid var(--profile-line);
}

.profile-page .profile-brand {
  font-family: var(--profile-serif);
  font-size: 1.25rem;
  font-weight: 550;
  line-height: 1.4;
  color: var(--profile-ink);
  text-decoration: none;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.25rem;
  font-size: 0.875rem;
}

.profile-container {
  padding-block: 1.25rem 3.5rem;
}

.profile-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  color: var(--profile-muted);
  font-size: 0.8125rem;
  line-height: 1.6;
}

.profile-breadcrumbs :where(ol, ul) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  padding: 0;
  list-style: none;
}

.profile-breadcrumbs li + li {
  margin: 0;
}

.profile-breadcrumbs li + li::before {
  content: "/" / "";
  margin-inline-end: 0.5rem;
  color: var(--profile-line);
}

.profile-breadcrumbs [aria-current="page"] {
  color: var(--profile-ink);
}

.profile-hero {
  max-width: 52rem;
  padding-block: clamp(1.75rem, 5vw, 3.5rem) clamp(1.75rem, 4vw, 2.5rem);
}

.profile-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-block-start: 1.75rem;
}

.profile-eyebrow {
  margin-block-end: 0.75rem;
  color: var(--profile-accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.profile-page:lang(zh) .profile-eyebrow,
.profile-eyebrow:lang(zh) {
  letter-spacing: 0.04em;
}

.profile-intro {
  max-width: 46rem;
  margin-block-start: 1.25rem;
  color: var(--profile-muted);
  font-size: clamp(1rem, 2vw, 1.125rem);
  line-height: 1.85;
}

/* The entry's own map colour marks it, as the swatch does in the map panel. */
.profile-article .profile-eyebrow::before,
.directory-item h3::before {
  content: "";
  display: inline-block;
  width: 0.625rem;
  height: 0.625rem;
  margin-inline-end: 0.5rem;
  border-radius: 2px;
  background: var(--civ, var(--profile-accent));
  vertical-align: 0.05em;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 20rem);
  grid-template-areas: "main facts";
  align-items: start;
  gap: clamp(2rem, 5vw, 4rem);
  padding-block-start: clamp(1.75rem, 4vw, 2.5rem);
  border-top: 1px solid var(--profile-line);
}

.profile-main {
  grid-area: main;
  min-width: 0;
}

.profile-facts {
  grid-area: facts;
  position: sticky;
  top: 1.5rem;
  min-width: 0;
  padding: 0.25rem 1.5rem;
  border: 1px solid var(--profile-line);
  border-top: 3px solid var(--civ, var(--profile-accent));
  border-radius: 0.5rem;
  background: var(--profile-raised);
}

.profile-facts > div {
  min-width: 0;
  padding-block: 1rem;
}

.profile-facts > div + div {
  border-top: 1px solid var(--profile-line);
}

.profile-page dt {
  margin-block-end: 0.25rem;
  color: var(--profile-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.profile-page:lang(zh) dt {
  letter-spacing: 0.02em;
}

.profile-section + .profile-section {
  margin-block-start: clamp(2rem, 5vw, 3rem);
}

.profile-section h2 {
  margin-block-end: 1rem;
}

.profile-page .profile-achievements {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 0.75rem;
  padding: 0;
  list-style: none;
}

.profile-page .profile-achievements li {
  margin: 0;
  padding: 0.875rem 1rem 0.875rem 1.125rem;
  border: 1px solid var(--profile-line);
  border-inline-start: 3px solid var(--civ, var(--profile-accent));
  border-radius: 0.375rem;
  background: var(--profile-raised);
  font-weight: 500;
  line-height: 1.5;
}

.profile-notes h2 {
  font-family: var(--profile-sans);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--profile-muted);
}

.profile-page:lang(zh) .profile-notes h2 {
  letter-spacing: 0.02em;
}

.profile-notes p {
  max-width: 65ch;
  color: var(--profile-muted);
  font-size: 0.875rem;
  line-height: 1.7;
}

.profile-notes p + p {
  margin-block-start: 0.625rem;
}

.profile-page .profile-external::after {
  content: "\2197" / "";
  margin-inline-start: 0.375rem;
  font-size: 0.9em;
}

.profile-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-block-start: clamp(2.5rem, 6vw, 4rem);
  padding-block-start: 1.5rem;
  border-top: 1px solid var(--profile-line);
}

.profile-page .profile-pager a {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.125rem;
  padding: 0.875rem 1.125rem;
  border: 1px solid var(--profile-line);
  border-radius: 0.5rem;
  background: var(--profile-raised);
  text-decoration: none;
  transition:
    border-color 150ms,
    background-color 150ms;
}

.profile-page .profile-pager a:hover {
  border-color: var(--civ, var(--profile-navy));
  background: #ebe6de;
}

.profile-page .profile-pager-next {
  grid-column: 2;
  align-items: flex-end;
  text-align: end;
}

.profile-pager small {
  color: var(--profile-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.profile-pager-prev small::before {
  content: "\2190\00a0" / "";
}

.profile-pager-next small::after {
  content: "\00a0\2192" / "";
}

.profile-pager span {
  font-family: var(--profile-serif);
  font-size: 1.125rem;
  font-weight: 550;
  line-height: 1.35;
}

.profile-page dd {
  line-height: 1.7;
}

.profile-facts dd {
  font-weight: 500;
}

.profile-card {
  min-width: 0;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--profile-line);
  border-radius: 0.5rem;
  background: var(--profile-raised);
}

.profile-card > * + * {
  margin-block-start: 1rem;
}

.profile-card :where(p, ul, ol, dl) {
  max-width: 65ch;
}

.profile-card :where(ul, ol) {
  line-height: 1.8;
}

.profile-card li::marker {
  color: var(--profile-accent);
}

.profile-card > dl > div + div {
  margin-block-start: 1rem;
}

.profile-page .profile-cta,
.profile-page .profile-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.625rem 1rem;
  border: 1px solid var(--profile-navy);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
}

.profile-page .profile-cta {
  background: var(--profile-navy);
  color: var(--profile-raised);
}

.profile-page .profile-cta:hover {
  background: #203c4e;
  color: var(--profile-raised);
}

.profile-page .profile-secondary {
  border-color: var(--profile-line);
  background: transparent;
  color: var(--profile-navy);
}

.profile-page .profile-secondary:hover {
  border-color: var(--profile-navy);
  background: #ebe6de;
}

.profile-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1.25rem 2rem;
  border-top: 1px solid var(--profile-line);
  color: var(--profile-muted);
  font-size: 0.8125rem;
}

.profile-footer p {
  max-width: 65ch;
}

.directory-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 2rem 2.5rem;
  max-width: 70rem;
  margin-block-start: 0.5rem;
}

.directory-group {
  min-width: 0;
}

.directory-group h2 {
  padding-block-end: 0.75rem;
  border-bottom: 1px solid var(--profile-line);
  font-size: 1.5rem;
}

.directory-group > p {
  margin-block: 0.75rem;
  color: var(--profile-muted);
  font-size: 0.875rem;
}

.directory-group :where(ul, ol) {
  margin-block-start: 0.5rem;
  padding: 0;
  list-style: none;
}

.directory-group li + li {
  margin: 0;
}

.directory-item {
  min-width: 0;
  border-bottom: 1px solid var(--profile-line);
}

.profile-page a.directory-item,
.profile-page .directory-item > a {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  width: 100%;
  min-height: 44px;
  padding: 0.75rem 0.25rem;
  text-decoration: none;
}

.directory-item :where(strong, h3) {
  color: var(--profile-navy);
  font-family: var(--profile-sans);
  font-size: 0.9375rem;
  font-weight: 600;
}

.directory-item :where(small, p) {
  color: var(--profile-muted);
  font-size: 0.8125rem;
  line-height: 1.6;
}

.profile-page a.directory-item:hover,
.profile-page .directory-item > a:hover {
  background: #ebe6de;
  color: var(--profile-accent);
}

.directory-item a:hover :where(strong, h3),
a.directory-item:hover :where(strong, h3) {
  color: var(--profile-accent);
}

/* Related entries: compact chips in each entry's map colour. */
.profile-page .profile-related ul,
.profile-page .profile-references ol {
  max-width: 65ch;
}

.profile-page .profile-related ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
  gap: 0.5rem;
  margin-block-start: 1rem;
  padding: 0;
  list-style: none;
}

.profile-page .profile-related li {
  margin: 0;
}

.profile-page .profile-related a {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  height: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--profile-line);
  border-inline-start: 3px solid var(--civ, var(--profile-accent));
  border-radius: 0.375rem;
  background: var(--profile-raised);
  line-height: 1.4;
  text-decoration: none;
}

.profile-page .profile-related a:hover {
  background: #ebe6de;
}

.profile-related a span {
  font-weight: 600;
}

.profile-related a small,
.profile-related > p,
.profile-references > p,
.profile-references li span,
.article-note {
  color: var(--profile-muted);
  font-size: 0.875rem;
}

.profile-references li span {
  margin-inline-start: 0.375rem;
}

.profile-references li small {
  display: block;
  color: var(--profile-muted);
  font-size: 0.75rem;
}

/* Inline links inside running text keep the line's own rhythm. */
.profile-page
  :where(
    .article-section p,
    .article-list li,
    .profile-references li,
    .profile-notes p
  )
  a[href]:not(.profile-cta, .profile-secondary) {
  display: inline;
  min-height: 0;
  padding: 0;
}

.profile-page .article-page .profile-section,
.profile-page .article-toc {
  max-width: 46rem;
}

.article-section > * + * {
  margin-block-start: 1rem;
}

.article-section p {
  max-width: 65ch;
}

.article-toc {
  margin-block-end: clamp(2rem, 5vw, 3rem);
}

.profile-page .article-toc h2 {
  font-family: var(--profile-sans);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--profile-muted);
}

.profile-page .article-toc li + li {
  margin-block-start: 0;
}

.article-keys {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 0.5rem 1.5rem;
}

.article-keys > div {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.profile-page .article-keys dt {
  flex: none;
  margin: 0;
  letter-spacing: 0;
  text-transform: none;
}

.profile-page kbd {
  display: inline-block;
  min-width: 1.75rem;
  padding: 0.0625rem 0.375rem;
  border: 1px solid var(--profile-line);
  border-bottom-width: 2px;
  border-radius: 0.25rem;
  background: var(--profile-raised);
  color: var(--profile-ink);
  font-family: var(--profile-sans);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
}

/* A long list of short names reads better in columns. */
#contemporaries .article-list {
  columns: 3 11rem;
  column-gap: 2rem;
}

#contemporaries .article-list li {
  break-inside: avoid;
  margin-block: 0 0.375rem;
}

.directory-guides {
  margin-block: 2rem;
}

.profile-footer nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1.25rem;
}

@media (max-width: 56rem) {
  .profile-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "facts" "main";
    gap: 2rem;
    padding-block-start: 0;
    border-top: 0;
  }

  .profile-facts {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 1.5rem;
    padding-block: 0.25rem;
  }

  /* Two columns: the divider sits between rows, not between neighbours. */
  .profile-facts > div + div {
    border-top: 0;
  }

  .profile-facts > div:nth-child(n + 3) {
    border-top: 1px solid var(--profile-line);
  }
}

@media (max-width: 42rem) {
  .profile-header,
  .profile-container,
  .profile-footer {
    width: calc(100% - 2rem);
  }

  .profile-header {
    padding-block: 0.75rem;
  }

  .profile-actions {
    gap: 0.25rem 1rem;
  }

  .profile-container {
    padding-block: 0.75rem 2.5rem;
  }

  .profile-hero-actions > a {
    flex: 1 1 12rem;
  }

  .profile-pager {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
  }

  .profile-page .profile-pager-next {
    grid-column: auto;
  }

  .directory-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
  }
}

@media (max-width: 24rem) {
  .profile-facts {
    grid-template-columns: minmax(0, 1fr);
    padding-inline: 1.125rem;
  }

  .profile-facts > div + div {
    border-top: 1px solid var(--profile-line);
  }
}

@media (prefers-reduced-motion: reduce) {
  .profile-page *,
  .profile-page *::before,
  .profile-page *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .profile-page {
    background: #fff;
    color: #000;
    font-size: 10pt;
  }

  .profile-header,
  .profile-container,
  .profile-footer {
    width: 100%;
    max-width: none;
  }

  .profile-actions {
    display: none;
  }

  .profile-card,
  .profile-facts,
  .profile-achievements li {
    background: #fff;
    break-inside: avoid;
  }

  .profile-facts {
    position: static;
  }

  .profile-pager,
  .profile-related,
  .article-toc {
    display: none;
  }

  .profile-page a[href] {
    min-height: 0;
    color: #000;
  }

  .profile-page .profile-cta,
  .profile-page .profile-secondary {
    background: transparent;
    color: #000;
    border-color: #777;
  }

  .profile-page :where(h1, h2, h3) {
    break-after: avoid;
  }
}
