/*
 * 运维知识库视觉层
 * 保留 index.html 中的数据与布局逻辑，本文件只负责统一品牌、层级、交互和响应式体验。
 */

:root {
  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #ffffff;
  --surface-soft: #f6f8f9;
  --ink: #15212b;
  --ink2: #52616b;
  --ink3: #87949b;
  --line: #dde3e5;
  --line2: #edf1f2;
  --gold: #b8873f;
  --brand: #173f4f;
  --brand-soft: #e9f2f4;
  --shadow: 0 18px 55px -38px rgba(20, 39, 48, 0.55);
  --shadow-hover: 0 24px 65px -38px rgba(20, 39, 48, 0.72);
  --r-card: 18px;
  --r-big: 22px;
  --r-chip: 10px;
  --r-btn: 12px;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 0%, rgba(88, 137, 148, 0.12), transparent 29rem),
    radial-gradient(circle at 96% 8%, rgba(184, 135, 63, 0.11), transparent 27rem),
    linear-gradient(180deg, #f9fbfa 0%, #f0f4f3 55%, #edf1f0 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.32;
  background-image: linear-gradient(rgba(21, 33, 43, 0.026) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(21, 33, 43, 0.026) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, #000, transparent 82%);
}

.skip-link {
  position: fixed;
  left: 20px;
  top: 14px;
  z-index: 100;
  transform: translateY(-160%);
  padding: 10px 14px;
  color: #fff;
  background: var(--brand);
  border-radius: 10px;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.app {
  max-width: 1640px;
  padding: 28px 40px 72px;
}

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 32px;
  align-items: end;
  margin-bottom: 18px;
  padding: 32px 34px;
  color: #f7faf9;
  background: linear-gradient(125deg, #102d39 0%, #173f4f 58%, #205766 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 26px;
  box-shadow: 0 28px 68px -38px rgba(11, 38, 49, 0.9);
}

.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 360px;
  height: 360px;
  right: -95px;
  top: -190px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 50%;
  box-shadow: 0 0 0 46px rgba(255, 255, 255, 0.035), 0 0 0 92px rgba(255, 255, 255, 0.025);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 11px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
}

.eyebrow::before {
  content: "";
  width: 24px;
  height: 2px;
  background: #d2a75d;
  border-radius: 99px;
}

.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(28px, 3.1vw, 45px);
  line-height: 1.18;
  letter-spacing: 0.025em;
}

.hero-copy {
  max-width: 720px;
  margin: 14px 0 0;
  color: rgba(240, 247, 246, 0.68);
  font-size: 13px;
  line-height: 1.85;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, 1fr));
  gap: 10px;
  min-width: 310px;
}

.hero-stat {
  padding: 15px 16px;
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  backdrop-filter: blur(8px);
}

.hero-stat strong,
.hero-stat span {
  display: block;
}

.hero-stat strong {
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1;
  color: #fff;
}

.hero-stat span {
  margin-top: 8px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.58);
  letter-spacing: 0.08em;
}

.topbar {
  position: sticky;
  top: 10px;
  z-index: 20;
  align-items: center;
  padding: 13px 14px;
  background: rgba(250, 252, 251, 0.88);
  border: 1px solid rgba(221, 227, 229, 0.9);
  border-radius: 18px;
  box-shadow: 0 16px 42px -34px rgba(18, 43, 53, 0.9);
  backdrop-filter: blur(18px) saturate(1.3);
}

.dom + .dom {
  margin-left: 8px;
  padding-left: 8px;
  border-left: 0;
}

.dom {
  padding: 9px 12px;
  border-radius: 11px;
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.dom:hover {
  background: #f0f4f4;
}

.dom.is-on {
  background: var(--surface-solid);
  box-shadow: 0 5px 17px -12px rgba(21, 33, 43, 0.75), inset 0 0 0 1px var(--line);
}

.dom b {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  color: #7e8b91;
}

.dom.is-on b {
  color: var(--brand);
}

.dom span {
  margin-top: 4px;
  font-size: 9.8px;
}

.search input,
.seg,
.ghost {
  min-height: 38px;
  border-color: #d9e0e2;
}

.search input {
  width: 248px;
  background: rgba(255, 255, 255, 0.92);
}

.search input:focus {
  border-color: #8eafb7;
  box-shadow: 0 0 0 4px rgba(49, 111, 125, 0.1);
}

.seg button[aria-pressed="true"] {
  background: var(--brand);
}

.ghost:hover {
  border-color: #94afb5;
  color: var(--brand);
  background: #f8fbfb;
}

.legend {
  margin-top: 14px;
  padding: 0 2px;
}

.legend span {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(218, 225, 226, 0.9);
  backdrop-filter: blur(8px);
}

.stage {
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  margin-top: 18px;
}

.map-col,
.detail,
.dv-branch {
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(220, 226, 227, 0.9);
  box-shadow: var(--shadow);
}

.map-col {
  min-height: 420px;
  padding: 8px 18px 20px;
  border-radius: 24px;
  backdrop-filter: blur(12px);
}

.branch {
  border-color: #e0e5e5;
  box-shadow: 0 12px 34px -28px rgba(20, 39, 48, 0.7);
}

.branch:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.root {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: linear-gradient(145deg, #122e3a, #193f4e);
  box-shadow: 0 24px 54px -32px rgba(7, 33, 44, 0.95);
}

.root .mark {
  margin-right: auto;
}

.root .meta {
  text-align: center;
}

.row:focus-visible,
.branch:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid #5c929d;
  outline-offset: 3px;
}

.detail {
  top: 108px;
  margin-top: 0;
  max-height: calc(100vh - 126px);
  padding: 25px 23px 20px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
}

.d-title {
  color: #173744;
}

.code,
.dv-code {
  color: #dce9e8;
  background: #152b34;
  border-color: #24424d;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.code-chk {
  color: #dce9e8;
  background: #1a333d;
}

.doc-view {
  max-width: 1120px;
}

.dv-branch {
  background: rgba(255, 255, 255, 0.88);
}

.doc {
  min-height: 220px;
  border-color: #dde4e5;
  box-shadow: var(--shadow);
}

.doc:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 30px;
  padding: 18px 4px 0;
  border-top: 1px solid rgba(204, 214, 216, 0.8);
  color: var(--ink3);
  font-size: 10.5px;
  letter-spacing: 0.035em;
}

@media (max-width: 1320px) {
  .topbar {
    position: relative;
    top: auto;
  }

  .domains {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .dom {
    flex: none;
  }

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

  .detail {
    position: static;
    max-height: none;
  }
}

@media (max-width: 900px) {
  .app {
    padding: 18px 18px 54px;
  }

  .hero {
    grid-template-columns: 1fr;
    padding: 26px 24px;
  }

  .hero-stats {
    min-width: 0;
  }

  .topbar,
  .controls {
    align-items: stretch;
  }

  .controls {
    width: 100%;
  }

  .search {
    flex: 1 1 240px;
  }

  .search input {
    width: 100%;
  }

  .map-col {
    padding-inline: 4px;
  }
}

@media (max-width: 620px) {
  .app {
    padding: 12px 10px 44px;
  }

  .hero {
    border-radius: 20px;
    padding: 23px 19px;
  }

  .hero-copy {
    font-size: 12px;
  }

  .hero-stats {
    grid-template-columns: 1fr;
  }

  .hero-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .hero-stat span {
    margin-top: 0;
  }

  .topbar {
    padding: 10px;
  }

  .controls {
    gap: 8px;
  }

  .seg {
    flex: 1;
  }

  .seg button {
    flex: 1;
  }

  .ghost {
    flex: 0 0 auto;
  }

  .legend {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 7px;
  }

  .legend span {
    flex: none;
  }

  .map-col {
    border-radius: 18px;
  }

  .detail {
    border-radius: 18px;
  }

  .site-footer {
    flex-direction: column;
    gap: 6px;
  }
}

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

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

@media print {
  .hero,
  .site-footer,
  .skip-link {
    display: none !important;
  }
}
