/* Shared wiki layout — 顶栏/侧栏字号与布局不依赖各页 Tailwind 配置 */

/* 各页高度不同会出现/消失纵向滚动条，导致整页（含顶栏）相对浏览器标签左右偏移 */
html {
  scrollbar-gutter: stable;
}

/* —— 顶栏：三列固定栅格，中间导航永远居中，切换页面不左右跳 —— */
.wiki-header-inner {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(auto, 1fr) auto;
  align-items: center;
  height: 4rem;
  max-width: 1280px;
  margin: 0 auto;
  padding-left: 32px;
  padding-right: 32px;
  column-gap: 16px;
  box-sizing: border-box;
}

@media (max-width: 767px) {
  .wiki-header-inner {
    grid-template-columns: 1fr auto;
    padding-left: 16px;
    padding-right: 16px;
  }

  .wiki-top-nav {
    display: none !important;
  }

  .wiki-header-tools {
    justify-self: end;
    min-width: auto;
  }
}

.wiki-header-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  min-width: 0;
  overflow: hidden;
}

.wiki-brand-title {
  font-family: Quicksand, sans-serif;
  font-size: 24px;
  line-height: 32px;
  font-weight: 700;
  color: #325f3f;
  white-space: nowrap;
}

.wiki-brand-sub {
  font-family: Inter, sans-serif;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #414941;
  opacity: 0.6;
  white-space: nowrap;
  display: none;
}

@media (min-width: 1024px) {
  .wiki-header-inner {
    grid-template-columns: minmax(220px, 280px) minmax(auto, 1fr) auto;
  }
}

@media (min-width: 1280px) {
  .wiki-header-inner {
    grid-template-columns: minmax(340px, 360px) minmax(auto, 1fr) auto;
  }

  .wiki-brand-sub {
    display: inline;
  }
}

.wiki-top-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  justify-self: center;
}

.wiki-top-nav .wiki-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.75rem;
  height: 2.5rem;
  padding: 0 0.625rem;
  border-bottom: 2px solid transparent;
  font-family: Inter, sans-serif;
  font-size: 14px;
  line-height: 20px;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: #414941;
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s;
  box-sizing: border-box;
  white-space: nowrap;
}

.wiki-top-nav .wiki-nav-link:hover {
  color: #325f3f;
}

.wiki-top-nav .wiki-nav-link.is-active {
  color: #325f3f;
  border-bottom-color: #325f3f;
}

.wiki-header-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  justify-self: end;
  min-width: 0;
}

.wiki-search-mobile-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 0.75rem;
  background: rgba(240, 244, 239, 0.92);
  color: #8c4e37;
  cursor: pointer;
  padding: 0;
}

@media (min-width: 640px) {
  .wiki-search-mobile-btn {
    display: none;
  }
}

.wiki-search-wrap {
  position: relative;
  display: none;
}

.wiki-search-wrap.is-mobile-open {
  display: block;
  position: fixed;
  left: 0;
  right: 0;
  top: 4rem;
  z-index: 80;
  padding: 0.75rem 1rem;
  background: rgba(255, 248, 246, 0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(65, 73, 65, 0.12);
  box-shadow: 0 8px 24px rgba(44, 22, 14, 0.08);
}

.wiki-search-wrap.is-mobile-open .wiki-search-input {
  width: 100%;
  max-width: none;
  min-width: 0;
}

@media (min-width: 640px) {
  .wiki-search-wrap {
    display: block;
  }
}

.wiki-search-wrap .wiki-search-input {
  width: 11rem;
  max-width: 11rem;
  min-width: 8rem;
  height: 2.75rem;
  box-sizing: border-box;
  background: rgba(240, 244, 239, 0.92) !important;
  border: 1px solid transparent !important;
  border-radius: 0.875rem !important;
  padding: 0.5rem 1rem 0.5rem 2.75rem !important;
  font-family: Inter, sans-serif;
  font-size: 16px;
  line-height: 24px;
  box-shadow: none !important;
  appearance: none;
  -webkit-appearance: none;
}

@media (min-width: 900px) {
  .wiki-search-wrap .wiki-search-input {
    width: 14rem;
    max-width: 14rem;
    min-width: 14rem;
  }
}

@media (max-width: 1080px) {
  .wiki-header-inner {
    grid-template-columns: minmax(210px, auto) minmax(auto, 1fr) auto;
  }
}

.wiki-search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.375rem);
  max-height: min(22rem, 60vh);
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(65, 73, 65, 0.14);
  border-radius: 0.875rem;
  box-shadow: 0 12px 32px rgba(44, 22, 14, 0.12);
  backdrop-filter: blur(10px);
  z-index: 120;
  padding: 0.375rem;
}

.wiki-search-wrap.is-mobile-open .wiki-search-results {
  position: static;
  margin-top: 0.5rem;
  max-height: 50vh;
}

.wiki-search-hit {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.625rem;
  text-decoration: none;
  color: #2c160e;
  transition: background 0.15s;
}

.wiki-search-hit:hover,
.wiki-search-hit.is-active {
  background: rgba(161, 210, 170, 0.28);
}

.wiki-search-hit-title {
  font-family: Quicksand, sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #325f3f;
  line-height: 1.3;
}

.wiki-search-hit-snippet {
  font-family: Inter, sans-serif;
  font-size: 13px;
  line-height: 1.4;
  color: #414941;
  opacity: 0.85;
}

.wiki-search-hit-page {
  font-family: Inter, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8c4e37;
  opacity: 0.75;
}

.wiki-search-empty {
  padding: 0.875rem 0.75rem;
  font-family: Inter, sans-serif;
  font-size: 14px;
  color: #414941;
  text-align: center;
}

.wiki-search-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px #325f3f;
}

.wiki-search-wrap .material-symbols-outlined {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: #8c4e37;
  pointer-events: none;
  font-size: 1.25rem;
  z-index: 1;
}

.wiki-lang-btn {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: #414941;
  background: transparent;
  border: none;
  padding: 0.5rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-family: Inter, sans-serif;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.wiki-lang-btn:hover {
  background: rgba(240, 244, 239, 0.8);
}

/* —— 左侧栏：统一字号（与村庄页配置无关） —— */
.wiki-sidebar-title {
  font-family: Quicksand, sans-serif;
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
  color: #5d4037;
  margin: 0;
}

.wiki-sidebar-subtitle {
  font-family: Inter, sans-serif;
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
  color: #414941;
  opacity: 0.7;
  margin: 0;
}

.wiki-sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  color: #414941;
  text-decoration: none;
  font-family: Inter, sans-serif;
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
  transition: background 0.2s;
}

.wiki-sidebar-link:hover {
  background: rgba(136, 164, 124, 0.12);
}

.wiki-sidebar-link.is-active {
  background: #4a7856;
  color: #cbfed4;
  font-weight: 700;
}

.wiki-sidebar-link .material-symbols-outlined {
  font-size: 1.5rem;
  width: 1.5rem;
  height: 1.5rem;
}

/* —— 页面骨架 —— */
.wiki-page-shell {
  display: flex;
  flex: 1;
  width: 100%;
  padding-top: 4rem;
  min-height: calc(100vh - 4rem);
}

.wiki-sidebar {
  display: none;
  width: 16rem;
  flex-shrink: 0;
  border-right: 1px solid rgba(193, 201, 191, 0.35);
  background: #fff1ed;
}

.wiki-mobile-drawer {
  display: block;
}

@media (min-width: 768px) {
  .wiki-sidebar {
    display: block;
  }

  .wiki-mobile-drawer {
    display: none;
  }
}

.wiki-sidebar-inner {
  position: sticky;
  top: 4rem;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  padding: 1rem;
}

.wiki-main-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.wiki-site-footer {
  width: 100%;
  flex-shrink: 0;
  position: relative;
  z-index: 20;
}

.wiki-footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.95fr) minmax(0, 0.95fr) minmax(0, 1.15fr);
  gap: 2rem 2.75rem;
  align-items: start;
}

.wiki-footer-about {
  max-width: 26rem;
}

.wiki-footer-col h4 {
  margin: 0 0 0.75rem;
}

.wiki-footer-col nav:not(.wiki-footer-stay-links) {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.wiki-footer-disclaimer {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.wiki-footer-disclaimer-line {
  margin: 0;
  font-family: Inter, sans-serif;
  font-size: 13px;
  line-height: 21px;
  color: rgba(255, 249, 240, 0.72);
}

.wiki-footer-stay-desc {
  margin: 0 0 0.625rem;
  font-family: Inter, sans-serif;
  font-size: 13px;
  line-height: 20px;
  color: rgba(255, 249, 240, 0.62);
}

.wiki-footer-stay-links {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem 1.5rem;
  margin: 0;
  width: 100%;
}

.wiki-footer-stay .wiki-footer-action {
  flex: 0 0 auto;
  white-space: nowrap;
}

.wiki-footer-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-family: Inter, sans-serif;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 249, 240, 0.8);
  text-decoration: none;
  transition: color 0.2s;
}

.wiki-footer-link .material-symbols-outlined {
  font-size: 1rem;
  color: rgba(188, 239, 197, 0.85);
}

.wiki-footer-link:hover {
  color: #bcefc5;
  text-decoration: underline;
}

.wiki-footer-action {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-family: Inter, sans-serif;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 249, 240, 0.8);
  text-decoration: none;
  transition: color 0.2s;
}

.wiki-footer-action .material-symbols-outlined {
  font-size: 1rem;
  color: rgba(188, 239, 197, 0.85);
}

.wiki-footer-action:hover {
  color: #bcefc5;
  text-decoration: underline;
}

@media (max-width: 900px) {
  .wiki-footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .wiki-footer-grid {
    grid-template-columns: 1fr;
  }
}

body.wiki-site {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wiki-main-column.has-mobile-bottom-nav {
  padding-bottom: 5rem;
}

@media (min-width: 768px) {
  .wiki-main-column.has-mobile-bottom-nav {
    padding-bottom: 0;
  }
}

.wiki-mobile-bottom-nav {
  background: rgba(255, 248, 246, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(193, 201, 191, 0.35);
}

/* ─── Language selector (appended, do not modify rules above) ─── */
.wiki-lang-wrap {
  display: flex;
  align-items: center;
}
.wiki-lang-label {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--color-on-surface-variant, #5c6b5a);
  cursor: pointer;
}
.wiki-lang-label .material-symbols-outlined {
  font-size: 20px;
}
.wiki-lang-select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  color: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  padding: 2px 4px;
  outline: none;
  max-width: 96px;
}
.wiki-lang-select:focus-visible {
  outline: 2px solid var(--color-primary, #3a7d44);
  border-radius: 4px;
}
@media (max-width: 640px) {
  .wiki-lang-select {
    max-width: 56px;
    font-size: 12px;
  }
}
