:root {
  color-scheme: light;
  --paper: #f4f2eb;
  --ink: #22241f;
  --muted: #696b62;
  --line: #dcd9cf;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.page-shell {
  display: flex;
  width: min(100% - 64px, 1040px);
  min-height: 100svh;
  flex-direction: column;
  margin: 0 auto;
}

.topbar {
  display: flex;
  height: 70px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: clamp(10px, 2.5vw, 28px);
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.035em;
  text-decoration: none;
}

.wordmark-mark {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
}

.wordmark-dot {
  color: #899b65;
}

.topbar-note,
.menu-meta,
.footer {
  font-family: var(--mono);
  font-size: 10px;
}

.topbar-note {
  color: var(--muted);
}

.topbar-note span {
  padding-left: 4px;
  color: #96a278;
}

.site-navigation {
  display: flex;
  min-width: 0;
  height: 100%;
  flex: 1 1 auto;
  align-items: stretch;
  justify-content: center;
  gap: clamp(4px, 1.3vw, 18px);
  margin: 0;
}

.menu-group {
  position: relative;
  display: flex;
  align-items: stretch;
}

.menu-trigger {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 3px 3px 0 0;
  padding: 0 clamp(12px, 2vw, 22px);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.menu-trigger:hover,
.menu-trigger[aria-expanded="true"] {
  background: rgb(255 255 255 / 48%);
  color: #536342;
  border-bottom-color: #899b65;
}

.menu-trigger:focus-visible,
.menu-item:focus-visible,
.wordmark:focus-visible {
  outline: 3px solid #455d36;
  outline-offset: 3px;
}

.menu-panel {
  display: grid;
  position: absolute;
  z-index: 2;
  top: 100%;
  left: 50%;
  width: max-content;
  min-width: 148px;
  max-width: min(320px, calc(100vw - 36px));
  gap: 5px;
  padding: 8px 7px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper);
  box-shadow: 0 12px 30px rgb(38 41 32 / 12%);
  transform: translateX(-50%);
}

.menu-panel[hidden] {
  display: none;
}

.menu-item {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 3px;
  text-decoration: none;
  transition: background-color 160ms ease;
}

.menu-item:hover {
  background: rgb(255 255 255 / 70%);
}

.menu-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.menu-meta {
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.menu-arrow {
  margin-left: auto;
  color: #899b65;
  font-size: 14px;
}

.menu-lock {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  margin-left: auto;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
}

.footer {
  display: flex;
  flex: 0 0 auto;
  justify-content: space-between;
  margin-top: auto;
  padding: 14px 0 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.footer-note {
  font-family: var(--sans);
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 36px, 560px);
  }

  .topbar {
    height: 64px;
    gap: 10px;
  }

  .menu-group:first-child .menu-panel {
    left: -8px;
    transform: none;
  }

  .menu-group:last-child .menu-panel {
    right: 0;
    left: auto;
    transform: none;
  }
}

@media (max-width: 520px) {
  .topbar {
    display: grid;
    height: 96px;
    grid-template-columns: 1fr auto;
    grid-template-rows: 52px 43px;
    gap: 0 8px;
  }

  .wordmark {
    grid-column: 1;
    grid-row: 1;
  }

  .topbar-note {
    grid-column: 2;
    grid-row: 1;
  }

  .site-navigation {
    width: 100%;
    height: 43px;
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    gap: 6px;
  }

  .menu-trigger {
    padding: 0 14px;
    font-size: 14px;
  }

  .menu-item {
    min-height: 42px;
    gap: 8px;
    padding: 7px 8px;
  }

  .menu-meta {
    font-size: 8px;
  }

  .footer {
    padding: 12px 0 14px;
  }
}

@media (max-height: 620px) {
  .topbar {
    height: 54px;
  }

  .footer {
    padding-top: 9px;
    padding-bottom: 12px;
  }
}

@media (max-width: 520px) and (max-height: 620px) {
  .topbar {
    height: 84px;
    grid-template-rows: 44px 39px;
  }

  .site-navigation {
    height: 39px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
