:root {
  --c-cream: #F2E8D5;
  --c-ink: #1A1815;
  --c-red: #E85D2A;
  --c-red-dark: #B23C16;
  --c-blue: #00A3FF;
  --c-blue-deep: #005B9F;
  --c-green: #39FF14;
  --c-sand: #D8CDB8;
  --c-graphite: #33302B;
  --c-cream-light: #FFF8EC;

  --font-display: "Inter", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;

  --container: 1200px;
  --radius: 10px;
  --shadow: 0 6px 20px rgba(26, 24, 21, 0.08);
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--c-cream);
  color: var(--c-ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin-block: 0 0.5em;
  font-family: var(--font-display);
  color: var(--c-ink);
  line-height: 1.2;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  font-weight: 900;
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 800;
}

h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

p {
  margin-block: 0;
}

a {
  color: var(--c-red-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--c-red);
}

img {
  max-width: 100%;
  display: block;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

::selection {
  background: var(--c-red);
  color: var(--c-cream);
}

:focus-visible {
  outline: 2px solid var(--c-blue);
  outline-offset: 3px;
}

.page-frame {
  width: min(var(--container), calc(100% - 2rem));
  margin-inline: auto;
}

.prose {
  max-width: 68ch;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 1000;
  background: var(--c-red);
  color: var(--c-cream);
  padding: 0.75rem 1.25rem;
  border-radius: 4px;
  font-family: var(--font-display);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  outline: 2px solid var(--c-blue);
  outline-offset: 3px;
}

.btn,
.btn--ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--c-ink);
  color: var(--c-cream);
  border: 1px solid transparent;
  padding: 0.8rem 1.4rem;
  border-radius: 4px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.btn:hover {
  background: var(--c-red);
  color: #fff;
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(26, 24, 21, 0.18);
}

.btn--ghost {
  background: transparent;
  border-color: var(--c-ink);
  color: var(--c-ink);
}

.btn--ghost:hover {
  background: var(--c-ink);
  color: var(--c-cream);
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--c-green);
  box-shadow: 0 0 0 4px rgba(57, 255, 20, 0.15);
  flex-shrink: 0;
  animation: status-blink 2s ease-in-out infinite;
}

@keyframes status-blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

.site-header {
  background: var(--c-cream);
  position: relative;
  z-index: 50;
}

.site-header__topbar {
  background: var(--c-ink);
  color: var(--c-cream);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.7rem;
  padding: 0.45rem 1rem;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

.site-header__eyebrow {
  color: var(--c-sand);
  font-family: var(--font-display);
  font-weight: 600;
}

.site-header__runstate {
  color: var(--c-cream);
  font-family: var(--font-display);
  font-size: 0.8rem;
}

.site-header__shell {
  padding-block: var(--space-5) var(--space-4);
}

.masthead {
  text-align: center;
  padding-block: var(--space-3) var(--space-4);
}

.masthead__brand {
  margin: 0;
}

.masthead__link {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2.4rem, 8vw, 5.5rem);
  line-height: 1.05;
  color: var(--c-ink);
  text-decoration: none;
  letter-spacing: -0.03em;
}

.masthead__link:hover {
  color: var(--c-ink);
}

.masthead__accent {
  color: var(--c-red);
}

.masthead__link:hover .masthead__accent {
  color: var(--c-red-dark);
}

.masthead__sub {
  margin-top: 0.4rem;
  color: var(--c-graphite);
  font-size: 0.95rem;
  letter-spacing: 0.32em;
  font-family: var(--font-display);
  font-weight: 600;
}

.masthead__sub::before {
  content: "";
  display: inline-block;
  width: 34px;
  height: 2px;
  background: var(--c-red);
  transform: skew(-20deg) translateY(-3px);
  margin-right: 0.6rem;
}

.site-nav-wrap {
  position: relative;
  background: var(--c-ink);
  border-radius: 6px;
  padding: 0.35rem;
}

.site-nav {
  display: flex;
  justify-content: center;
}

.site-nav__list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.15rem 0.5rem;
}

.site-nav__item {
  margin: 0;
}

.site-nav__link {
  display: inline-block;
  padding: 0.65rem 1.05rem;
  color: var(--c-cream);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.site-nav__link:hover {
  color: #fff;
  background: rgba(232, 93, 42, 0.22);
  border-bottom-color: var(--c-red);
}

.site-nav__link[aria-current="page"] {
  color: var(--c-red);
  border-bottom-color: var(--c-red);
  background: rgba(232, 93, 42, 0.12);
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: 1px solid rgba(242, 232, 213, 0.35);
  color: var(--c-cream);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 0.85rem;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.nav-toggle:hover {
  border-color: var(--c-red);
  background: rgba(232, 93, 42, 0.15);
}

.nav-toggle__label {
  font-family: var(--font-display);
  font-weight: 600;
}

.nav-toggle__bars {
  display: inline-block;
  width: 16px;
  height: 2px;
  background: var(--c-cream);
  position: relative;
}

.nav-toggle__bars::before,
.nav-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--c-cream);
  transition: transform 0.2s ease;
}

.nav-toggle__bars::before {
  top: -5px;
}

.nav-toggle__bars::after {
  top: 5px;
}

.site-progress {
  --progress: 0;
  height: 3px;
  background: var(--c-sand);
  position: relative;
  overflow: hidden;
}

.site-progress::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  background: linear-gradient(90deg, var(--c-red) 0%, var(--c-blue) 80%, var(--c-green) 100%);
  transform: scaleX(var(--progress));
  transform-origin: left top;
}

.site-footer {
  background: var(--c-ink);
  color: var(--c-cream);
  padding-block: 3rem 2rem;
  margin-top: var(--space-8);
  position: relative;
}

.site-footer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--c-red) 0 45%, var(--c-blue) 45% 55%, var(--c-green) 55%);
  opacity: 0.6;
}

.site-footer__grid {
  display: grid;
  gap: 2.5rem;
  padding-bottom: 2rem;
}

.site-footer__brand {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-start;
}

.site-footer__wordmark {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  font-style: italic;
  color: var(--c-cream);
  margin: 0;
}

.site-footer__wordmark::after {
  content: ".";
  color: var(--c-red);
}

.site-footer__statement {
  color: var(--c-sand);
  font-size: 0.9rem;
  line-height: 1.6;
}

.site-footer__heading {
  color: var(--c-cream);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.site-footer__list a {
  display: inline-block;
  padding-block: 0.25rem;
  color: var(--c-sand);
  text-decoration: none;
  line-height: 1.9;
}

.site-footer__list a:hover {
  color: var(--c-red);
}

.site-footer__contact p {
  margin: 0.25rem 0;
  color: var(--c-sand);
  font-size: 0.9rem;
  line-height: 1.6;
}

.site-footer__meta {
  border-top: 1px solid rgba(242, 232, 213, 0.15);
  padding-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  font-size: 0.85rem;
  color: var(--c-sand);
}

.site-footer__meta span {
  white-space: nowrap;
}

.site-footer__trust {
  margin-top: 1.5rem;
  max-width: 68ch;
  font-size: 0.85rem;
  color: rgba(216, 205, 184, 0.7);
  line-height: 1.6;
}

.breadcrumbs {
  margin-block: 1rem;
  font-size: 0.9rem;
}

.breadcrumbs__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  color: var(--c-graphite);
}

.breadcrumbs__item + .breadcrumbs__item::before {
  content: "/";
  margin-inline: 0.35rem;
  color: var(--c-sand);
}

.breadcrumbs__link {
  color: var(--c-graphite);
  text-decoration: none;
}

.breadcrumbs__link:hover {
  color: var(--c-red);
}

.breadcrumbs__item[aria-current="page"] {
  color: var(--c-ink);
  font-weight: 600;
}

.chapter-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-style: italic;
  color: var(--c-red);
  font-size: 1.1rem;
}

.chapter-mark::before {
  content: "";
  width: 30px;
  height: 2px;
  background: var(--c-red);
  transform: skew(-18deg);
}

.grid {
  display: grid;
  gap: 2rem;
}

.grid--2,
.grid--3,
.grid--4 {
  grid-template-columns: 1fr;
}

.card {
  background: var(--c-cream-light);
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid rgba(26, 24, 21, 0.06);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(26, 24, 21, 0.1);
}

.card__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
}

.media-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(120deg, var(--c-sand) 20%, var(--c-cream-light) 80%);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 0%, transparent 62%, rgba(26, 24, 21, 0.06) 62%, rgba(26, 24, 21, 0.06) 63%, transparent 63%), repeating-linear-gradient(-45deg, rgba(26, 24, 21, 0.02) 0 2px, transparent 2px 14px);
}

.media-frame::after {
  content: "";
  position: absolute;
  right: -20px;
  bottom: -18px;
  width: 140px;
  height: 140px;
  background: rgba(232, 93, 42, 0.14);
  border-radius: 100% 20% 50% 50% / 80% 40% 60% 20%;
  transform: rotate(12deg);
}

.media-frame--tall {
  aspect-ratio: 4 / 5;
}

.media-frame--wide {
  aspect-ratio: 21 / 9;
}

.console {
  background: var(--c-ink);
  color: var(--c-cream);
  border-radius: 10px;
  padding: 1.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.7;
  box-shadow: var(--shadow);
}

.console__line {
  display: flex;
  gap: 0.75rem;
  padding-block: 0.15rem;
}

.console__prompt {
  color: var(--c-green);
}

.console__signal {
  color: var(--c-blue);
}

.console__key {
  color: var(--c-red);
}

@media (min-width: 768px) {
  .site-footer__grid {
    grid-template-columns: 1.4fr 1fr 1fr 1.4fr;
  }

  .grid--2,
  .grid--3,
  .grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid--3,
  .grid--4 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1200px) {
  .grid--4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 767px) {
  .site-header__topbar {
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.75rem;
    text-align: center;
  }

  .site-header__shell {
    padding-block: 1rem 0.75rem;
  }

  .masthead {
    padding-block: 0.75rem;
  }

  .masthead__sub {
    font-size: 0.8rem;
    letter-spacing: 0.18em;
  }

  .site-nav-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.5rem;
  }

  .site-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 0.15rem);
    z-index: 40;
    background: var(--c-ink);
    border-radius: 6px;
    box-shadow: 0 12px 24px rgba(26, 24, 21, 0.28);
  }

  .site-nav[data-open] {
    display: block;
  }

  .site-nav__list {
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.5rem;
  }

  .site-nav__item {
    width: 100%;
  }

  .site-nav__link {
    display: block;
    border: 0;
    border-left: 2px solid transparent;
    padding: 0.7rem 0.9rem;
    border-radius: 4px;
    font-size: 0.9rem;
  }

  .site-nav__link:hover {
    background: rgba(232, 93, 42, 0.2);
    border-left-color: var(--c-red);
  }

  .site-nav__link[aria-current="page"] {
    border-left-color: var(--c-red);
    background: rgba(232, 93, 42, 0.12);
  }

  .nav-toggle {
    display: inline-flex;
  }

  .site-footer__grid {
    gap: 2rem;
  }

  .site-footer__meta {
    gap: 0.75rem 1rem;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .status-dot {
    animation: none;
  }

  .site-progress {
    display: none;
  }

  .btn:hover,
  .card:hover,
  .site-nav__link:hover {
    transform: none;
  }
}
