:root {
  --font-sans: "Segoe UI Variable", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-serif: "Georgia", "Times New Roman", "Songti SC", "STSong", serif;
  --font-body: var(--font-sans);
  --font-display: var(--font-sans);

  --page-bg: #090e1f;
  --page-bg-soft: rgba(9, 14, 31, 0.45);
  --card-bg: rgba(247, 244, 255, 0.94);
  --card-strong: #ffffff;
  --card-soft: rgba(255, 255, 255, 0.84);
  --card-line: rgba(170, 168, 220, 0.28);
  --text-main: #404167;
  --text-soft: #667095;
  --text-strong: #ffffff;
  --title-accent: #6250d8;
  --purple: #7d60e6;
  --purple-deep: #5a35c9;
  --purple-soft: rgba(125, 96, 230, 0.14);
  --search-bg: rgba(250, 245, 255, 0.84);
  --shadow-xl: 0 28px 80px rgba(13, 16, 43, 0.38);
  --shadow-lg: 0 18px 46px rgba(10, 14, 36, 0.22);
  --shadow-sm: 0 10px 24px rgba(10, 14, 36, 0.16);
  --radius-xl: 24px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --site-width: min(1560px, calc(100% - 40px));
}

body[data-mode="dawn"] {
  --page-bg: #221633;
  --page-bg-soft: rgba(34, 22, 51, 0.42);
  --card-bg: rgba(255, 248, 252, 0.94);
  --card-strong: #fffdfd;
  --card-soft: rgba(255, 252, 255, 0.84);
  --card-line: rgba(236, 182, 220, 0.28);
  --text-main: #5c4165;
  --text-soft: #7e6987;
  --title-accent: #c252b8;
  --purple: #d474d0;
  --purple-deep: #8f3db1;
  --purple-soft: rgba(212, 116, 208, 0.16);
}

body[data-font="serif"] {
  --font-body: var(--font-serif);
  --font-display: var(--font-serif);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-bg);
  color: var(--text-main);
  font-family: var(--font-body);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 10% 15%, rgba(255, 255, 255, 0.12), transparent 22%),
    radial-gradient(circle at 84% 8%, rgba(255, 255, 255, 0.1), transparent 18%),
    radial-gradient(circle at 92% 62%, rgba(255, 255, 255, 0.08), transparent 16%),
    radial-gradient(circle at 4% 54%, rgba(255, 255, 255, 0.08), transparent 18%);
  z-index: -1;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

.scene-layer,
.scene-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.scene-layer {
  z-index: -4;
  background: url("./assets/scene-castle.svg") center top / cover no-repeat fixed;
}

.scene-overlay {
  z-index: -3;
  background:
    linear-gradient(180deg, rgba(4, 8, 22, 0.28), rgba(6, 11, 26, 0.68)),
    linear-gradient(180deg, rgba(9, 12, 28, 0.04), rgba(9, 12, 28, 0.22));
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 40;
  transition: background-color 180ms ease, backdrop-filter 180ms ease, box-shadow 180ms ease;
}

.site-header.is-scrolled {
  background: rgba(7, 10, 25, 0.36);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 30px rgba(3, 6, 16, 0.18);
}

.site-header__inner,
.site-footer__inner {
  width: var(--site-width);
  margin: 0 auto;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 82px;
}

.site-brand__title {
  color: var(--text-strong);
  font: 700 1.05rem/1.1 var(--font-display);
  letter-spacing: 0.01em;
}

.site-nav,
.site-footer__links,
.settings-options,
.search-suggestions,
.feature-tools {
  display: flex;
  flex-wrap: wrap;
}

.site-nav {
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.site-nav__link {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.98rem;
}

.site-nav__link.is-active,
.site-nav__link:hover {
  color: #ffffff;
  text-shadow: 0 0 16px rgba(255, 255, 255, 0.24);
}

.site-search-button {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  color: var(--text-strong);
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
}

.hero-banner {
  position: relative;
  min-height: 560px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 150px 20px 180px;
  text-align: center;
}

.hero-banner__content {
  width: min(960px, 100%);
  position: relative;
  z-index: 2;
}

.hero-banner__content h1 {
  margin: 0;
  color: #ffffff;
  font: 700 clamp(2.8rem, 5vw, 4.4rem)/1.08 var(--font-display);
}

.hero-banner__content p {
  max-width: 880px;
  margin: 18px auto 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(1.05rem, 1.8vw, 1.28rem);
  line-height: 1.8;
}

.hero-banner__orb {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(2px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hero-banner__orb--left {
  left: 42px;
  top: 88px;
  width: 150px;
  height: 150px;
}

.hero-banner__orb--right {
  right: 46px;
  top: 120px;
  width: 138px;
  height: 138px;
}

.hero-banner__orb--lower {
  right: 88px;
  bottom: 52px;
  width: 164px;
  height: 164px;
}

.page-shell {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 26px;
  width: var(--site-width);
  margin: -96px auto 42px;
}

.sidebar {
  display: grid;
  gap: 16px;
  align-self: start;
  position: sticky;
  top: 96px;
}

.sidebar-card,
.featured-post-card,
.post-card,
.topic-card,
.timeline-card,
.friend-card,
.article-shell,
.note-card {
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.sidebar-card {
  background: var(--card-bg);
  border: 1px solid var(--card-line);
}

.sidebar-card--brand {
  padding-bottom: 18px;
}

.sidebar-card__header {
  padding: 30px 24px 28px;
  background: linear-gradient(155deg, rgba(131, 98, 233, 0.96), rgba(93, 50, 201, 0.96));
  color: #ffffff;
}

.sidebar-card__header h2 {
  margin: 0;
  font: 700 1.28rem/1.2 var(--font-display);
}

.sidebar-card__header p {
  margin: 12px 0 0;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.7;
  font-size: 0.95rem;
}

.sidebar-card__menu {
  display: grid;
  gap: 4px;
  padding: 14px 14px 0;
}

.sidebar-category {
  display: grid;
  gap: 4px;
  padding: 12px 12px;
  border-radius: var(--radius-md);
  transition: background-color 180ms ease, transform 180ms ease, color 180ms ease;
}

.sidebar-category span {
  color: var(--text-main);
  font-weight: 600;
}

.sidebar-category small {
  color: var(--text-soft);
}

.sidebar-category:hover,
.sidebar-category.is-active {
  background: var(--purple-soft);
  transform: translateX(2px);
}

.sidebar-category.is-active span,
.sidebar-category:hover span {
  color: var(--title-accent);
}

.sidebar-search {
  display: block;
  width: calc(100% - 28px);
  min-height: 46px;
  margin: 14px auto 0;
  border-radius: var(--radius-sm);
  background: rgba(210, 196, 243, 0.48);
  color: var(--text-main);
  font-weight: 600;
}

.sidebar-card--tabs {
  padding: 16px;
}

.sidebar-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.sidebar-tab {
  min-height: 42px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
}

.sidebar-tab.is-active {
  background: var(--purple-soft);
  color: var(--title-accent);
  font-weight: 700;
}

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

.mini-stat {
  min-height: 98px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--card-soft);
  border: 1px solid rgba(193, 188, 229, 0.24);
}

.mini-stat strong {
  display: block;
  color: var(--title-accent);
  font: 700 1.08rem/1.2 var(--font-display);
}

.mini-stat span,
.sidebar-note p {
  color: var(--text-soft);
  line-height: 1.7;
}

.sidebar-note {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.64);
}

.feature-links {
  display: grid;
  gap: 10px;
}

.feature-links a,
.feature-tools button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: var(--radius-sm);
  background: var(--card-soft);
  color: var(--text-main);
  border: 1px solid rgba(193, 188, 229, 0.24);
}

.feature-tools {
  gap: 10px;
  margin-top: 12px;
}

.feature-tools button {
  flex: 1;
}

.main-column {
  display: grid;
  gap: 20px;
  align-self: start;
}

.featured-post-card,
.post-card,
.topic-card,
.timeline-card,
.friend-card,
.article-shell {
  background: var(--card-bg);
  border: 1px solid var(--card-line);
}

.featured-post-card {
  display: block;
  padding: 34px 36px;
}

.featured-post-card h2,
.post-card h3,
.topic-card h2,
.timeline-card h2,
.friend-card h2,
.article-shell h2,
.article-section h3 {
  margin: 0;
  font-family: var(--font-display);
}

.featured-post-card h2 {
  color: var(--title-accent);
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.16;
}

.featured-post-card p,
.post-card p,
.topic-card p,
.timeline-card p,
.friend-card p,
.article-shell p,
.note-card p,
.empty-copy {
  color: var(--text-soft);
  line-height: 1.9;
}

.featured-post-card p {
  margin: 20px 0 0;
  font-size: 1.02rem;
}

.post-meta-line {
  margin-top: 20px;
  color: #8590af;
  font-size: 0.97rem;
}

.content-stack,
.timeline-list,
.friend-grid,
.related-links {
  display: grid;
  gap: 20px;
}

.post-card {
  display: grid;
  grid-template-columns: 33% 1fr;
}

.post-card__cover {
  min-height: 260px;
  background-position: center;
  background-size: cover;
}

.post-card__body {
  padding: 30px 34px;
}

.post-card__category,
.topic-card__eyebrow,
.article-shell__eyebrow {
  margin: 0 0 10px;
  color: #8a8fd0;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.post-card h3 {
  color: var(--title-accent);
  font-size: clamp(1.7rem, 2.5vw, 2.5rem);
  line-height: 1.18;
}

.post-card p {
  margin: 18px 0 0;
  font-size: 1rem;
}

.post-card:hover,
.featured-post-card:hover,
.friend-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

.topic-card {
  padding: 30px 34px;
}

.topic-card__intro h2,
.article-shell h2 {
  color: var(--title-accent);
  font-size: clamp(1.9rem, 2.8vw, 2.7rem);
  line-height: 1.2;
}

.topic-card__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 22px;
}

.topic-card__grid article,
.note-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--card-soft);
  border: 1px solid rgba(193, 188, 229, 0.24);
}

.topic-card__grid h3,
.article-section h3 {
  color: var(--title-accent);
  font-size: 1.25rem;
}

.topic-card__grid ul {
  margin: 14px 0 0;
  padding-left: 20px;
  color: var(--text-soft);
  line-height: 1.8;
}

.article-shell {
  overflow: hidden;
}

.article-shell__cover {
  min-height: 300px;
  background-position: center;
  background-size: cover;
}

.article-shell__body {
  padding: 34px 38px 36px;
}

.article-section + .article-section {
  margin-top: 24px;
}

.article-section h3 {
  margin-bottom: 12px;
}

.article-section p {
  margin: 0 0 12px;
}

.timeline-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: start;
  padding: 24px 28px;
  gap: 22px;
}

.timeline-card__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: 0 16px;
  border-radius: 999px;
  background: linear-gradient(145deg, rgba(129, 98, 236, 0.95), rgba(93, 50, 201, 0.95));
  color: #ffffff;
  font-weight: 700;
}

.timeline-card__body p:first-child {
  margin: 0 0 8px;
  color: #8a8fd0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.85rem;
}

.timeline-card__body h2 {
  color: var(--title-accent);
  font-size: 1.7rem;
}

.timeline-card__body p:last-child {
  margin: 12px 0 0;
}

.friend-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.friend-card {
  display: block;
  padding: 28px 30px;
}

.friend-card h2 {
  color: var(--title-accent);
  font-size: 1.8rem;
}

.friend-card p {
  margin: 14px 0 0;
}

.empty-copy {
  padding: 18px 0 0;
}

.site-footer {
  padding: 8px 0 34px;
}

.site-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: rgba(255, 255, 255, 0.78);
}

.site-footer__links {
  gap: 20px;
}

.settings-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  width: 72px;
  height: 56px;
  border-radius: 18px;
  background: rgba(250, 245, 255, 0.96);
  color: var(--title-accent);
  box-shadow: var(--shadow-xl);
}

.settings-panel {
  position: fixed;
  right: 22px;
  bottom: 92px;
  z-index: 50;
  width: min(320px, calc(100% - 24px));
  padding: 18px;
  border-radius: var(--radius-xl);
  background: rgba(250, 245, 255, 0.96);
  color: var(--text-main);
  box-shadow: var(--shadow-xl);
}

.settings-panel__header,
.search-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.settings-panel__header h2,
.search-modal__header h2 {
  margin: 0;
  color: var(--title-accent);
  font: 700 1.3rem/1.2 var(--font-display);
}

.settings-close {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
}

.settings-group + .settings-group {
  margin-top: 16px;
}

.settings-group p {
  margin: 0 0 10px;
  color: var(--text-soft);
}

.settings-options {
  gap: 10px;
}

.settings-options button {
  flex: 1;
  min-height: 44px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(193, 188, 229, 0.3);
}

.settings-options button.is-active {
  background: linear-gradient(145deg, rgba(129, 98, 236, 0.96), rgba(93, 50, 201, 0.96));
  color: #ffffff;
}

.search-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.search-modal__backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  background: rgba(7, 10, 21, 0.68);
}

.search-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100% - 24px));
  margin: 8vh auto 0;
  padding: 24px;
  border-radius: var(--radius-xl);
  background: rgba(250, 245, 255, 0.98);
  box-shadow: var(--shadow-xl);
}

.search-modal__input {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.search-modal__input span {
  color: var(--text-soft);
}

.search-modal__input input {
  min-height: 52px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(193, 188, 229, 0.4);
  background: var(--search-bg);
  color: var(--text-main);
}

.search-results {
  display: grid;
  gap: 18px;
  margin-top: 20px;
}

.search-placeholder p,
.search-group p {
  margin: 0;
  color: var(--text-soft);
}

.search-suggestions {
  gap: 10px;
  margin-top: 14px;
}

.search-suggestions button,
.search-group a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(193, 188, 229, 0.3);
}

.search-group {
  display: grid;
  gap: 10px;
}

.search-group h3 {
  margin: 0;
  color: var(--title-accent);
  font: 700 1rem/1.2 var(--font-display);
}

@media (max-width: 1280px) {
  .site-nav {
    gap: 18px;
  }

  .page-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .site-header__inner {
    flex-wrap: wrap;
    justify-content: center;
    padding: 14px 0;
  }

  .site-brand {
    width: 100%;
    text-align: center;
  }

  .site-nav {
    width: 100%;
  }

  .hero-banner {
    min-height: 480px;
    padding-top: 190px;
  }

  .post-card,
  .timeline-card,
  .friend-grid,
  .topic-card__grid {
    grid-template-columns: 1fr;
  }

  .post-card__cover {
    min-height: 220px;
  }

  .timeline-card {
    gap: 14px;
  }
}

@media (max-width: 720px) {
  :root {
    --site-width: min(100%, calc(100% - 18px));
  }

  .hero-banner__content h1 {
    font-size: clamp(2.1rem, 12vw, 3.2rem);
  }

  .hero-banner__content p {
    font-size: 1rem;
  }

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

  .featured-post-card,
  .post-card__body,
  .topic-card,
  .timeline-card,
  .friend-card,
  .article-shell__body,
  .sidebar-card__header,
  .sidebar-card--tabs {
    padding-left: 20px;
    padding-right: 20px;
  }

  .featured-post-card {
    padding-top: 24px;
    padding-bottom: 24px;
  }

  .site-footer__inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .settings-fab {
    right: 14px;
    bottom: 14px;
  }

  .settings-panel {
    right: 12px;
    bottom: 80px;
  }
}
