:root {
  --ink: #08244d;
  --ink-2: #1c3b60;
  --red: #a70f0d;
  --red-line: rgba(167, 15, 13, .62);
  --paper: #fbf7ee;
  --white: #fffdf8;
  --line: rgba(8, 36, 77, .16);
  --shadow: 0 18px 48px rgba(8, 22, 45, .13);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, rgba(167, 15, 13, .08), transparent 22rem),
    linear-gradient(135deg, #fffdf8 0%, #f4ecdf 56%, #edf4f7 100%);
  font-family: "Songti SC", "Noto Serif SC", "STSong", Georgia, serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(8, 36, 77, .032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(8, 36, 77, .028) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .58), transparent 72%);
}

.masthead,
main,
.site-footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.masthead {
  min-height: 330px;
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 34px;
  align-items: center;
  padding: 46px 0 28px;
}

.brand-mark {
  width: 112px;
  height: 112px;
  border: 2px solid rgba(8, 36, 77, .26);
  border-radius: 50%;
  position: relative;
  background: repeating-radial-gradient(circle, transparent 0 13px, rgba(8, 36, 77, .2) 14px 15px);
}

.brand-mark::before,
.brand-mark::after,
.brand-mark span {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.brand-mark::before {
  width: 32px;
  height: 32px;
  top: 38px;
  left: 38px;
  background: var(--red);
  box-shadow: 0 0 0 9px rgba(167, 15, 13, .08);
}

.brand-mark::after {
  width: 8px;
  height: 8px;
  top: 7px;
  left: 52px;
  background: var(--ink);
  box-shadow: 49px 51px 0 var(--red), -35px 49px 0 var(--ink), 20px 95px 0 var(--ink);
}

.brand-mark span:nth-child(1) {
  width: 60px;
  height: 2px;
  top: 55px;
  left: 55px;
  background: rgba(8, 36, 77, .5);
  transform: rotate(18deg);
  transform-origin: left;
}

.brand-mark span:nth-child(2) {
  width: 2px;
  height: 56px;
  top: 55px;
  left: 55px;
  background: rgba(167, 15, 13, .42);
  transform: rotate(-38deg);
  transform-origin: top;
}

.brand-mark span:nth-child(3) {
  width: 82px;
  height: 82px;
  inset: 14px;
  border: 1px dashed rgba(8, 36, 77, .35);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--red);
  font: 800 13px/1.3 "PingFang SC", "Microsoft YaHei", sans-serif;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  color: var(--ink);
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.04;
  letter-spacing: 0;
  white-space: nowrap;
}

.intro {
  max-width: 980px;
  margin: 0;
  color: #203a59;
  font: 700 clamp(17px, 2vw, 24px)/1.7 "PingFang SC", "Microsoft YaHei", sans-serif;
  white-space: pre-line;
}

.hero-actions {
  display: flex;
  gap: 8px;
  margin-top: 22px;
}

.lang {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, .56);
  cursor: pointer;
  font: 800 13px/1 "PingFang SC", sans-serif;
}

.lang.active {
  color: #fff;
  background: var(--ink);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 22px;
  padding-top: 20px;
  border-top: 2px solid var(--ink);
}

.section-head h2 {
  margin-bottom: 0;
  color: var(--red);
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.12;
}

.section-head p {
  max-width: 560px;
  margin-bottom: 4px;
  color: #45546a;
  font: 500 15px/1.7 "PingFang SC", "Microsoft YaHei", sans-serif;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  padding-bottom: 56px;
}

.topic-card {
  overflow: hidden;
  border: 1px solid var(--red-line);
  border-radius: 8px;
  background: rgba(255, 253, 248, .88);
  box-shadow:
    inset 0 0 0 1px rgba(255, 253, 248, .72),
    0 12px 30px rgba(8, 22, 45, .09);
}

.topic-cover {
  width: 100%;
  display: block;
  position: relative;
  padding: 0;
  border: 0;
  background: #fff;
  cursor: pointer;
}

.topic-cover img {
  display: block;
  width: 100%;
  aspect-ratio: 11 / 10;
  object-fit: cover;
  object-position: top;
}

.topic-cover span {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 7px 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--red);
  font: 800 12px/1 "PingFang SC", sans-serif;
}

.topic-body {
  padding: 18px;
}

.topic-body h2 {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 26px;
  line-height: 1.22;
}

.topic-body h3 {
  margin-bottom: 12px;
  color: var(--red);
  font-size: 17px;
  line-height: 1.35;
}

.topic-body p {
  color: #41536a;
  font: 500 14px/1.75 "PingFang SC", "Microsoft YaHei", sans-serif;
}

.card-actions,
.media-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.primary-button,
.card-actions a,
.media-actions a,
.text-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--ink);
  cursor: pointer;
  text-decoration: none;
  font: 800 13px/1 "PingFang SC", "Microsoft YaHei", sans-serif;
}

.card-actions a,
.media-actions a {
  color: var(--ink);
  background: rgba(8, 36, 77, .08);
}

.ghost-button {
  width: 112px;
  height: 112px;
  margin-bottom: 22px;
  padding: 0;
  border: 2px solid rgba(167, 15, 13, .2);
  border-radius: 50%;
  color: #fff;
  background: var(--red);
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(167, 15, 13, .22);
  font: 900 17px/1 "PingFang SC", "Microsoft YaHei", sans-serif;
  text-align: center;
  white-space: nowrap;
  letter-spacing: 0;
}

.ghost-button::before {
  content: attr(data-label);
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: inherit;
}

html[lang="en"] .ghost-button::before {
  content: "Back to\a themes";
  white-space: pre;
  font-size: 15px;
  line-height: 1.12;
}

.ghost-button:hover {
  background: var(--ink);
  border-color: rgba(8, 36, 77, .22);
}

.detail-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: end;
  margin-bottom: 20px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, .9);
  box-shadow: var(--shadow);
}

.detail-hero h2 {
  margin-bottom: 8px;
  color: var(--red);
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.1;
}

.detail-hero h3 {
  margin-bottom: 12px;
  color: var(--ink);
  font-size: 22px;
}

.detail-hero p {
  max-width: 780px;
  margin: 0;
  color: #3f5269;
  font: 500 16px/1.75 "PingFang SC", "Microsoft YaHei", sans-serif;
}

.page-stack {
  display: grid;
  gap: 28px;
  padding-bottom: 62px;
}

.page-jump {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 18px;
  padding: 10px 0;
  background: rgba(251, 247, 238, .94);
  backdrop-filter: blur(10px);
}

.page-jump span {
  margin-right: 4px;
  color: var(--red);
  font: 900 13px/1 "PingFang SC", "Microsoft YaHei", sans-serif;
}

.page-jump a {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 11px;
  border: 1px solid rgba(8, 36, 77, .16);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 253, 248, .82);
  text-decoration: none;
  font: 800 12px/1 "PingFang SC", "Microsoft YaHei", sans-serif;
}

.content-page {
  display: grid;
  grid-template-columns: minmax(330px, 44%) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding: 22px;
  border: 1px solid var(--red-line);
  border-radius: 8px;
  background: rgba(255, 253, 248, .86);
  box-shadow:
    inset 0 0 0 1px rgba(255, 253, 248, .7),
    0 10px 26px rgba(8, 22, 45, .065);
}

.page-copy {
  position: sticky;
  top: 64px;
}

.page-copy h3 {
  margin-bottom: 14px;
  color: var(--ink);
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.2;
}

.page-copy h4 {
  margin-bottom: 8px;
  color: var(--red);
  font: 900 14px/1.2 "PingFang SC", "Microsoft YaHei", sans-serif;
}

.page-copy pre {
  max-height: min(66vh, 760px);
  overflow: auto;
  margin: 0;
  padding: 18px;
  border-left: 4px solid var(--red);
  border-radius: 6px;
  color: #21364f;
  background: rgba(8, 36, 77, .045);
  white-space: pre-wrap;
  word-break: break-word;
  font: 500 15px/1.78 "PingFang SC", "Microsoft YaHei", sans-serif;
}

.page-media button {
  width: 100%;
  display: block;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(8, 36, 77, .16);
  border-radius: 8px;
  background: #fff;
  cursor: zoom-in;
  box-shadow: 0 10px 24px rgba(8, 22, 45, .09);
}

.page-media img {
  width: 100%;
  aspect-ratio: 9 / 16;
  display: block;
  object-fit: contain;
  object-position: top;
  background: #fff;
}

.media-actions {
  justify-content: space-between;
  padding-top: 10px;
}

.media-actions span {
  color: var(--red);
  font: 900 13px/1 "PingFang SC", sans-serif;
}

.site-footer {
  display: flex;
  justify-content: flex-end;
  padding: 0 0 28px;
}

#observerLogin {
  border: 0;
  color: rgba(8, 36, 77, .32);
  background: transparent;
  cursor: pointer;
  font: 600 12px/1 "PingFang SC", sans-serif;
}

#observerLogin:hover {
  color: var(--ink);
}

.admin-dialog {
  width: min(560px, calc(100% - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.admin-dialog::backdrop {
  background: rgba(5, 14, 30, .46);
}

.admin-box {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 24px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.admin-box h2 {
  margin-bottom: 4px;
}

.dialog-close {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: var(--red);
  cursor: pointer;
  font-size: 22px;
}

.admin-box label {
  display: grid;
  gap: 7px;
  font: 800 13px/1.2 "PingFang SC", sans-serif;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(8, 36, 77, .2);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
  font: 500 14px/1.5 "PingFang SC", "Microsoft YaHei", sans-serif;
}

.admin-panel {
  display: grid;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.admin-panel p {
  margin: 0;
  color: #45546a;
  font: 500 14px/1.65 "PingFang SC", sans-serif;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 76px 74px 28px;
  background: rgba(5, 14, 30, .94);
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: min(100%, 920px);
  max-height: calc(100vh - 126px);
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 20px 70px rgba(0, 0, 0, .35);
}

.lightbox-top {
  position: absolute;
  top: 16px;
  left: 18px;
  right: 18px;
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 14px;
  align-items: center;
  color: #fff;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

.lightbox-top strong {
  display: block;
  line-height: 1.3;
}

.lightbox-top span {
  color: rgba(255,255,255,.72);
  font-size: 14px;
}

.text-button.inverse {
  color: var(--ink);
  background: #fff;
}

.icon-button,
.nav-button {
  border: 0;
  cursor: pointer;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

.icon-button {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  color: #fff;
  background: var(--red);
  font-size: 30px;
  line-height: 1;
}

.nav-button {
  position: absolute;
  top: 50%;
  width: 54px;
  height: 86px;
  border-radius: 8px;
  transform: translateY(-50%);
  color: #fff;
  background: rgba(255, 255, 255, .16);
  font-size: 54px;
  line-height: 1;
}

.prev {
  left: 14px;
}

.next {
  right: 14px;
}

@media (max-width: 1040px) {
  .topic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-page {
    grid-template-columns: minmax(300px, 42%) minmax(0, 1fr);
  }
}

@media (max-width: 820px) {
  .masthead {
    grid-template-columns: 1fr;
    min-height: auto;
    gap: 18px;
    padding-top: 30px;
  }

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

  .brand-mark::before {
    width: 26px;
    height: 26px;
    top: 29px;
    left: 29px;
  }

  .brand-mark::after,
  .brand-mark span {
    display: none;
  }

  h1 {
    white-space: normal;
  }

  .section-head,
  .detail-hero,
  .content-page {
    display: block;
  }

  .detail-hero .primary-button {
    margin-top: 16px;
  }

  .page-media {
    margin: 0 0 18px;
  }

  .page-copy {
    position: static;
  }
}

@media (max-width: 620px) {
  .masthead,
  main,
  .site-footer {
    width: min(100% - 24px, 1180px);
  }

  h1 {
    font-size: 40px;
  }

  .intro {
    font-size: 17px;
  }

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

  .topic-cover img {
    aspect-ratio: 16 / 11;
  }

  .content-page {
    padding: 15px;
  }

  .ghost-button {
    width: 92px;
    height: 92px;
    font-size: 14px;
  }

  html[lang="en"] .ghost-button::before {
    font-size: 12px;
  }

  .page-copy pre {
    max-height: 360px;
    font-size: 14px;
  }

  .lightbox {
    padding: 78px 12px 18px;
  }

  .lightbox-top {
    grid-template-columns: 42px 1fr;
  }

  .lightbox-top .inverse {
    display: none;
  }

  .nav-button {
    width: 42px;
    height: 62px;
    font-size: 40px;
  }
}
