:root {
  --bg: #f4f9fa;
  --surface: #ffffff;
  --surface-soft: #eef6f7;
  --sidebar: rgba(230, 242, 244, 0.92);
  --line: #dbe8eb;
  --line-strong: #c9dde1;
  --ink: #223239;
  --ink-soft: #3e545b;
  --muted: #5a6f76;
  --accent: #2f6f7e;
  --accent-deep: #1f4f5a;
  --accent-soft: #dcecef;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", "Segoe UI", system-ui, sans-serif;
  --serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", Georgia, serif;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

p,
li,
dd,
blockquote {
  text-wrap: pretty;
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--accent-deep);
  text-underline-offset: 2px;
}

button {
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection {
  background: #cfe4e8;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.skip-link {
  position: fixed;
  top: -4rem;
  left: 16px;
  z-index: 100;
  padding: 0.65rem 0.9rem;
  border-radius: 6px;
  background: var(--accent-deep);
  color: #fff;
  font-size: 0.82rem;
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
}

/* Sidebar */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: 240px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  box-shadow: 8px 0 24px rgba(31, 79, 90, 0.03);
  transition: width 0.22s ease;
}

body.is-collapsed .sidebar {
  width: 68px;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 74px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  flex: none;
  width: 36px;
  height: 36px;
  color: var(--accent);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 160px;
  overflow: hidden;
  white-space: nowrap;
  opacity: 1;
  transition: max-width 0.18s ease, opacity 0.12s ease;
}

.brand-text strong {
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.brand-text small {
  color: var(--muted);
  font-size: 0.66rem;
  letter-spacing: 0.02em;
}

body.is-collapsed .sidebar__brand {
  justify-content: center;
  gap: 0;
  padding-inline: 0;
}

body.is-collapsed .brand-text {
  max-width: 0;
  opacity: 0;
}

.sidebar__nav {
  flex: 1;
  padding: 10px 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 18px;
  border-left: 2px solid transparent;
  color: var(--ink-soft);
  font-size: 0.86rem;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nav-link:hover {
  background: rgba(47, 111, 126, 0.06);
  color: var(--accent-deep);
}

.nav-link.is-active {
  background: rgba(47, 111, 126, 0.09);
  border-left-color: var(--accent);
  color: var(--accent-deep);
}

.nav-link:focus-visible {
  outline-offset: -2px;
}

.icon {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-link__text {
  display: flex;
  align-items: baseline;
  gap: 8px;
  max-width: 150px;
  overflow: hidden;
  white-space: nowrap;
  opacity: 1;
  transition: max-width 0.18s ease, opacity 0.12s ease;
}

.nav-link__num {
  color: var(--muted);
  font-size: 0.64rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

.nav-link.is-active .nav-link__num {
  color: var(--accent);
}

body.is-collapsed .nav-link {
  justify-content: center;
  gap: 0;
  padding: 0;
}

body.is-collapsed .nav-link__text {
  max-width: 0;
  opacity: 0;
}

.sidebar__foot {
  max-height: 90px;
  padding: 14px 18px;
  overflow: hidden;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.7;
  opacity: 1;
  transition: max-height 0.18s ease, padding 0.18s ease, opacity 0.12s ease;
}

.sidebar__foot p {
  margin: 0;
}

body.is-collapsed .sidebar__foot {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-top-color: transparent;
  opacity: 0;
}

.sidebar__toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar__toggle:hover {
  background: rgba(47, 111, 126, 0.06);
  color: var(--accent-deep);
}

.sidebar__toggle-text {
  max-width: 90px;
  overflow: hidden;
  white-space: nowrap;
  opacity: 1;
  transition: max-width 0.18s ease, opacity 0.12s ease;
}

.icon-chevron {
  transition: transform 0.18s ease;
}

body.is-collapsed .sidebar__toggle {
  justify-content: center;
  padding: 0;
}

body.is-collapsed .sidebar__toggle-text {
  max-width: 0;
  opacity: 0;
}

body.is-collapsed .icon-chevron {
  transform: rotate(180deg);
}

/* Main area */

.main {
  min-height: 100vh;
  margin-left: 240px;
  transition: margin-left 0.22s ease;
}

body.is-collapsed .main {
  margin-left: 68px;
}

.main__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px clamp(20px, 3.4vw, 40px) 40px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 2px 2px 18px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 8px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3.1vw, 2.45rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.page-lede {
  max-width: 62ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.85;
}

.page-meta {
  flex: none;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.8;
  text-align: right;
  white-space: nowrap;
}

/* Top visual */

.banner {
  position: relative;
  margin: 0 0 22px;
  background: var(--bg);
}

.banner__video {
  display: block;
  width: 100%;
  height: auto;
  background: var(--bg);
}

/* Fade the video into the page on all four sides without changing its ratio. */
.banner::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(
      to right,
      var(--bg) 0%,
      rgba(244, 249, 250, 0) 8%,
      rgba(244, 249, 250, 0) 92%,
      var(--bg) 100%
    ),
    linear-gradient(
      to bottom,
      var(--bg) 0%,
      rgba(244, 249, 250, 0) 8%,
      rgba(244, 249, 250, 0) 92%,
      var(--bg) 100%
    );
}

/* Panels */

.content {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel {
  padding: clamp(18px, 2.4vw, 28px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(31, 79, 90, 0.035);
}

.panel--review {
  background: var(--surface-soft);
}

.panel__head {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.panel__index {
  margin: 3px 0 0;
  color: var(--accent);
  font-size: 0.64rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12em;
}

.panel__heading h2 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.35;
}

.panel__intro {
  max-width: 72ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.75;
}

/* Profile */

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(210px, 0.72fr);
  gap: 28px;
  align-items: start;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 28px;
  margin: 0;
}

.fact {
  min-width: 0;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.fact:nth-child(1),
.fact:nth-child(2) {
  padding-top: 0;
  border-top: 0;
}

.fact--wide {
  grid-column: 1 / -1;
}

.facts dt {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
}

.facts dd {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.8;
}

.latin {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
}

.relation-list {
  margin: 0;
  padding-left: 1.1em;
}

.relation-list li {
  margin: 0 0 4px;
}

.relation-list li:last-child {
  margin-bottom: 0;
}

.note-card {
  max-width: 34rem;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.note-card__label {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.note-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.8;
}

.note-card__mark {
  display: block;
  width: 120px;
  max-width: 100%;
  margin: 16px auto 2px;
  color: var(--accent);
  opacity: 0.55;
}

/* Timeline */

.timeline-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 28px;
  align-items: start;
}

.timeline {
  margin: 0;
  padding: 0 0 0 1.05rem;
  border-left: 1px solid var(--line-strong);
  list-style: none;
}

.timeline li {
  position: relative;
  padding: 0 0 20px 1rem;
}

.timeline li:last-child {
  padding-bottom: 0;
}

.timeline li::before {
  content: "";
  position: absolute;
  top: 5px;
  left: -5px;
  width: 9px;
  height: 9px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: var(--surface);
}

.timeline__when {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}

.timeline h3 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 0.94rem;
  line-height: 1.4;
}

.timeline p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.8;
}

/* Magic */

.magic-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 28px;
  align-items: start;
}

.magic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 28px;
}

.magic-item {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.magic-item:nth-child(1),
.magic-item:nth-child(2) {
  padding-top: 0;
  border-top: 0;
}

.magic-item h3 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.4;
}

.magic-item p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.8;
}

/* Quotes */

.quote-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 28px;
  align-items: start;
}

.quotes {
  display: grid;
  gap: 0;
}

.quote {
  margin: 0;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.quote:first-child {
  padding-top: 0;
  border-top: 0;
}

.quote:last-child {
  padding-bottom: 0;
}

.quote blockquote {
  margin: 0;
}

.quote blockquote p {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.18rem;
  line-height: 1.6;
}

.quote figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.7;
}

/* Gallery */

.gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.art {
  min-width: 0;
  margin: 0;
}

.thumb {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  aspect-ratio: 16 / 10;
  padding: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef6f7;
}

.art:nth-child(2) .thumb {
  background: #f0f5f2;
}

.art:nth-child(3) .thumb {
  background: #edf4f7;
}

.art:nth-child(4) .thumb {
  background: #f3f6f0;
}

.thumb__top,
.thumb__bottom {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.64rem;
  letter-spacing: 0.04em;
}

.thumb__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.thumb__wave {
  width: 74px;
  height: 15px;
  color: var(--accent);
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
  opacity: 0.55;
}

.art figcaption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.6;
}

.art figcaption strong {
  color: var(--ink-soft);
  font-weight: 600;
}

/* Review */

.review-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.review-aside {
  padding-right: 22px;
  border-right: 1px solid var(--line);
}

.review-aside__label {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.review-aside__quote {
  margin: 0;
  color: var(--accent-deep);
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.65;
}

.review-body p {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.9;
}

.review-body p:last-child {
  margin-bottom: 0;
}

.signature {
  margin-top: 16px !important;
  color: var(--muted);
  font-size: 0.78rem;
}

/* Footer */

.site-footer {
  margin-top: 18px;
  padding: 20px 2px 4px;
  border-top: 1px solid var(--line);
}

.site-footer p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.7;
}

.site-footer strong {
  color: var(--ink-soft);
}

.copyright {
  max-width: 85ch;
}

.footer-meta {
  margin-top: 8px;
}

/* Keep the inner columns readable before the sidebar becomes a top bar */

@media (max-width: 1080px) {
  .profile-layout,
  .timeline-layout,
  .magic-layout,
  .quote-layout,
  .review-layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .review-aside {
    padding: 0 0 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .review-aside__quote {
    max-width: 34ch;
  }
}

/* Tablet / mobile: sidebar becomes a top icon bar */

@media (max-width: 900px) {
  html {
    scroll-padding-top: 126px;
  }

  .sidebar {
    position: fixed;
    inset: 0 0 auto;
    width: auto;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 6px 18px rgba(31, 79, 90, 0.04);
    transition: none;
  }

  body.is-collapsed .sidebar {
    width: auto;
  }

  .sidebar__brand {
    min-height: 52px;
    padding: 8px 58px 4px 14px;
    border-bottom: 0;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  body.is-collapsed .sidebar__brand {
    justify-content: flex-start;
    gap: 10px;
    padding: 8px 58px 4px 14px;
  }

  body.is-collapsed .brand-text {
    max-width: 180px;
    opacity: 1;
  }

  .sidebar__nav {
    flex: none;
    display: flex;
    flex-direction: row;
    gap: 2px;
    padding: 0 8px 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .nav-link {
    flex: 0 0 auto;
    width: auto;
    min-height: 40px;
    padding: 0 8px;
    gap: 8px;
    border-left: 0;
    border-bottom: 2px solid transparent;
    border-radius: 7px;
  }

  .nav-link.is-active {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
  }

  .nav-link__text {
    max-width: 0;
    opacity: 0;
  }

  body:not(.is-collapsed) .nav-link__text {
    max-width: 120px;
    opacity: 1;
  }

  body.is-collapsed .nav-link {
    justify-content: center;
    gap: 0;
    padding: 0 8px;
  }

  .sidebar__foot {
    display: none;
  }

  .sidebar__toggle {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 38px;
    min-height: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.45);
  }

  .sidebar__toggle-text {
    display: none;
  }

  .main,
  body.is-collapsed .main {
    margin-left: 0;
    padding-top: 112px;
  }

  .main__inner {
    padding: 18px 14px 28px;
  }

  .page-head {
    align-items: flex-start;
    padding-bottom: 14px;
  }

  .page-meta {
    text-align: left;
  }

  .profile-layout,
  .timeline-layout,
  .magic-layout,
  .quote-layout,
  .review-layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .review-aside {
    padding: 0 0 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .review-aside__quote {
    max-width: 34ch;
  }
}

/* Narrow screens */

@media (max-width: 640px) {
  .page-head {
    flex-direction: column;
    gap: 8px;
  }

  h1 {
    font-size: 1.75rem;
  }

  .page-lede {
    font-size: 0.88rem;
  }

  .panel {
    padding: 16px;
  }

  .panel__head {
    grid-template-columns: 1.8rem minmax(0, 1fr);
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 13px;
  }

  .facts {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .fact:nth-child(2) {
    padding-top: 13px;
    border-top: 1px solid var(--line);
  }

  .fact--wide {
    grid-column: auto;
  }

  .magic-grid {
    grid-template-columns: 1fr;
  }

  .magic-item:nth-child(2) {
    padding-top: 14px;
    border-top: 1px solid var(--line);
  }

  .gallery {
    grid-template-columns: 1fr;
  }

  .quote blockquote p {
    font-size: 1.08rem;
  }

  .note-card__mark {
    width: 100px;
  }

  .site-footer {
    padding-top: 16px;
  }
}

@media (max-width: 380px) {
  .main__inner {
    padding-inline: 12px;
  }

  .nav-link {
    padding-inline: 10px;
  }

  body.is-collapsed .nav-link {
    padding-inline: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .sidebar,
  .main,
  .skip-link,
  .nav-link,
  .sidebar__toggle,
  .brand-text,
  .nav-link__text,
  .sidebar__toggle-text,
  .sidebar__foot,
  .icon-chevron {
    transition: none;
  }
}

@media print {
  .sidebar,
  .banner,
  .skip-link {
    display: none !important;
  }

  .main,
  body.is-collapsed .main {
    margin: 0;
    padding: 0;
  }

  .main__inner {
    max-width: none;
    padding: 0;
  }

  .panel {
    break-inside: avoid;
    border-color: #ccc;
    box-shadow: none;
  }

  .site-footer {
    border-top-color: #ccc;
  }
}
