/**
 * 墨序OFD转换 - 自定义样式补充
 * Tailwind 无法表达的部分：对比滑块、动画、打印样式等
 */

/* ============================================================
   COMPARISON SLIDER
   依赖 clip-path、vendor-prefixed range input、伪元素
   ============================================================ */
.comparison-container {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,.10);
  border: 1px solid #E2E8F0;
  aspect-ratio: 16 / 10;
  background: #fff;
  cursor: ew-resize;
}

.comparison-before,
.comparison-after {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.comparison-after {
  clip-path: inset(0 0 0 50%);
}

.comparison-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  transform: translateX(-50%);
  background: #2563EB;
  cursor: ew-resize;
  -webkit-appearance: none;
  appearance: none;
  border: none;
  outline: none;
  z-index: 10;
  opacity: 0;
}
.comparison-handle::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #2563EB;
  cursor: ew-resize;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.comparison-handle::-moz-range-thumb {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #2563EB;
  cursor: ew-resize;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
}

/* Handle line */
.comparison-container::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  background: #2563EB;
  transform: translateX(-50%);
  z-index: 5;
  pointer-events: none;
}

/* Handle circle */
.comparison-container::before {
  content: '\27F7';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #2563EB;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #2563EB;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
  pointer-events: none;
}

/* Comparison doc mockups */
.comp-doc {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.comp-doc-header {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  color: #475569;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ofd-doc .comp-doc-header { background: #EFF6FF; color: #2563EB; }
.pdf-doc .comp-doc-header { background: #EFF6FF; color: #2563EB; }

.comp-doc-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* Invoice mockup */
.comp-invoice {
  width: 100%;
  max-width: 500px;
  padding: 32px;
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  position: relative;
}
.comp-inv-title {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  color: #1E293B;
  margin-bottom: 16px;
}
.comp-inv-no {
  font-size: 11px;
  color: #94A3B8;
  text-align: center;
  margin-bottom: 20px;
}
.comp-inv-table {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}
.comp-inv-row {
  display: grid;
  grid-template-columns: 2fr 0.8fr 0.6fr 1fr;
  padding: 8px 0;
  font-size: 12px;
  border-bottom: 1px solid #E2E8F0;
  color: #475569;
}
.comp-inv-row.head {
  font-weight: 600;
  color: #1E293B;
  border-bottom-width: 2px;
}
.comp-inv-total {
  text-align: right;
  font-size: 16px;
  font-weight: 700;
  color: #1E293B;
  margin-bottom: 20px;
}
.comp-inv-seal {
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: #94A3B8;
  padding: 6px 14px;
  border: 2px solid #CBD5E1;
  border-radius: 50%;
  display: inline-block;
  float: right;
  transform: rotate(-15deg);
  opacity: 0.6;
}

.comp-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  border-radius: 4px;
}
.ofd-badge { background: #2563EB; }
.pdf-badge { background: #2563EB; }

/* Comparison tabs */
.comp-tabs {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 32px;
  background: #F2F3F5;
  padding: 4px;
  border-radius: 12px;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}
.comp-tab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: #475569;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.comp-tab:hover { color: #1E293B; }
.comp-tab.active {
  background: #fff;
  color: #2563EB;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

/* ============================================================
   ARCHITECTURE DIAGRAM (Deployment page)
   ============================================================ */
.arch-diagram {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #E2E8F0;
  padding: 32px;
}
.arch-layer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: #F7F8FA;
  border-radius: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.arch-client { background: #EFF6FF; border: 1px solid #BFDBFE; }
.arch-gateway { background: #EFF6FF; border: 1px solid #BFDBFE; }
.arch-service { background: #EFF6FF; border: 1px solid #BFDBFE; }
.arch-data { background: #EFF6FF; border: 1px solid #BFDBFE; }
.arch-node {
  padding: 10px 18px;
  background: #fff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #1E293B;
  border: 1px solid #E2E8F0;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  white-space: nowrap;
}
.arch-node.primary {
  background: #2563EB;
  color: #fff;
  border-color: #2563EB;
}

/* ============================================================
   SCROLL ANIMATIONS
   ============================================================ */
.anim-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.anim-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.anim-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.anim-up.animate-in,
.anim-left.animate-in,
.anim-right.animate-in {
  opacity: 1;
  transform: translate(0);
}

/* Stagger children */
.anim-stagger > * {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  transition-delay: calc(var(--stagger-index, 0) * 80ms);
}
.anim-stagger.animate-in > * {
  opacity: 1;
  transform: translateY(0);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .anim-up,
  .anim-left,
  .anim-right,
  .anim-stagger > * {
    opacity: 1;
    transform: none;
    transition: none !important;
  }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  #site-header,
  #mobile-nav,
  .mobile-toggle,
  .comparison-handle,
  .skip-link { display: none !important; }

  body { background: #fff; color: #000; font-size: 12pt; }
  .section { padding: 20pt 0; page-break-inside: avoid; }
  .section-alt { background: #fff; }
  .comparison-container,
  .arch-diagram { border: 1px solid #ccc; box-shadow: none; }
  a { color: #000; text-decoration: underline; }
}

/* ============================================================
   RESPONSIVE OVERRIDES
   ============================================================ */
@media (max-width: 1024px) {
  .comparison-container { aspect-ratio: 4/3; }
  .comp-tabs, .sol-tabs { flex-wrap: wrap; }
  .comp-invoice { padding: 20px; }
  .comp-inv-row { font-size: 11px; grid-template-columns: 1.5fr 0.8fr 0.6fr 1fr; }
  .arch-diagram { padding: 20px; }
}

@media (max-width: 480px) {
  .comparison-container { aspect-ratio: 3/4; }
  .comp-invoice { padding: 16px; }
  .comp-inv-title { font-size: 16px; }
  .comp-inv-row { min-width: 300px; }
  .comp-inv-table { overflow-x: auto; }
}

/* ============================================================
   BACK TO TOP BUTTON
   ============================================================ */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #E2E8F0;
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  color: #475569;
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
  border-color: #2563EB;
  color: #2563EB;
  transform: translateY(-2px);
}

/* ============================================================
   MOBILE TOGGLE ICON (preserved from old CSS for JS compatibility)
   ============================================================ */
.mobile-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: #1E293B;
  border-radius: 1px;
  transition: all 0.3s ease;
  transform-origin: center;
}
.mobile-toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.mobile-toggle.open span:nth-child(2) {
  opacity: 0;
}
.mobile-toggle.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ============================================================
   PAGE HERO (shared across multiple product/marketing pages)
   ============================================================ */
.page-hero {
  padding: 80px 0 60px;
  text-align: center;
}
.page-hero-eyebrow {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: #2563EB;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  padding: 4px 12px;
  background: #EFF6FF;
  border-radius: 20px;
}
.page-hero-title {
  font-size: 2rem;
  font-weight: 700;
  color: #1E293B;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}
.page-hero-subtitle {
  font-size: 1.125rem;
  color: #94A3B8;
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.7;
}
@media (max-width: 768px) {
  .page-hero { padding: 60px 0 40px; }
  .page-hero-title { font-size: 1.5rem; }
}

/* ============================================================
   CODE LANGUAGE TABS (API page — JS adds .active class)
   ============================================================ */
.code-lang.active {
  color: #fff;
  background: #3E3E3E;
}

/* ============================================================
   SOLUTIONS TABS (JS adds .active class)
   ============================================================ */
.sol-tab.active {
  color: #2563EB;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.sol-panel { display: none; }
.sol-panel.active { display: block; }

/* ============================================================
   DEPLOYMENT PAGE
   ============================================================ */
.deploy-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 48px;
  align-items: start;
}

.arch-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1E293B;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid #2563EB;
  display: inline-block;
}

.arch-connector {
  text-align: center;
  padding: 8px 0;
  font-size: 11px;
  color: #94A3B8;
  font-weight: 500;
}
.arch-connector span {
  display: inline-block;
  padding: 2px 10px;
  background: #F2F3F5;
  border-radius: 20px;
}

.platform-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.platform-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  transition: all 0.15s ease;
  text-align: center;
}
.platform-item:hover {
  border-color: #2563EB;
  background: #EFF6FF;
}
.platform-item span {
  font-size: 12px;
  font-weight: 500;
  color: #1E293B;
}

.platform-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.platform-icon.win { background: #EFF6FF; color: #0078D4; }
.platform-icon.linux { background: #F0F0F0; color: #333; }
.platform-icon.uos { background: #EFF6FF; color: #2563EB; }
.platform-icon.kylin { background: #EFF6FF; color: #D4380D; }
.platform-icon.docker { background: #EFF6FF; color: #2496ED; }
.platform-icon.k8s { background: #EFF6FF; color: #326CE5; }
.platform-icon.kunpeng { background: #EFF6FF; color: #CF1322; }
.platform-icon.phytium { background: #EFF6FF; color: #2563EB; }

.deploy-scenarios {
  background: #fff;
  border-radius: 12px;
  padding: 16px 20px;
  border: 1px solid #E2E8F0;
}
.scenario-label {
  font-size: 13px;
  font-weight: 600;
  color: #1E293B;
  margin-bottom: 10px;
}
.scenario-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.scenario-tags span {
  font-size: 13px;
  padding: 4px 12px;
  background: #EFF6FF;
  color: #2563EB;
  border-radius: 20px;
  font-weight: 500;
}

@media (max-width: 1024px) {
  .deploy-layout { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .platform-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   SIDE TOOLBAR — WECHAT POPUP
   ============================================================ */
.side-toolbar {
  position: fixed;
  right: 32px;
  top: 65%;
  transform: translateY(-50%);
  z-index: 900;
  display: flex;
  flex-direction: column;
}

.side-tool-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 10px;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  cursor: pointer;
  transition: all .2s;
  color: #94A3B8;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
  width: 64px;
}
.side-tool-item:hover {
  border-color: #2563EB;
  color: #2563EB;
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
  transform: translateY(-2px);
}

.side-tool-label {
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

/* WeChat Popup */
.wechat-popup {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0,0,0,.1);
  border: 1px solid #F1F5F9;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s, visibility .2s;
  white-space: nowrap;
}
.side-tool-item:hover .wechat-popup,
.side-tool-item.active .wechat-popup {
  opacity: 1;
  visibility: visible;
}

/* Popup arrow pointing RIGHT → */
.wechat-popup::before {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-left-color: #E2E8F0;
}

.wechat-qr-code img {
  display: block;
}

.wechat-popup p {
  font-size: 12px;
  color: #64748B;
  text-align: center;
  margin-top: 8px;
  line-height: 1.6;
}
.wechat-popup small {
  font-size: 11px;
  color: #94A3B8;
}

@media (max-width: 768px) {
  .side-toolbar { right: 12px; }
  .side-tool-item { width: 56px; padding: 12px 8px; }
}

/* ============================================================
   CODE SYNTAX HIGHLIGHTING (API page)
   ============================================================ */
.syn-comment { color: #6A9955; }
.syn-cmd { color: #569CD6; font-weight: 600; }
.syn-str { color: #CE9178; }
.syn-key { color: #9CDCFE; }
.syn-num { color: #B5CEA8; }
.syn-json { color: #D4D4D4; }
