/* 营造智慧算法解析页面样式 */
.page-algorithm {
  background: var(--bg-light);
}

main.algorithm-main {
  min-height: calc(100vh - var(--header-h));
  padding: 0 clamp(1rem, 4vw, 2rem) 3rem;
  max-width: 56rem;
  margin: 0 auto;
}

.algorithm-hero {
  position: relative;
  padding: clamp(1.5rem, 4vw, 2.5rem) clamp(1rem, 4vw, 2rem) 3rem;
  max-width: 56rem;
  margin: 0 auto;
  text-align: center;
}

.algorithm-eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--ink-muted);
  margin-bottom: 0.5rem;
}

.algorithm-hero-content h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 4.5vw, 2.35rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink);
  margin: 0 0 0.75rem;
}

.algorithm-hero-content p {
  font-size: 0.95rem;
  color: var(--ink-muted);
  line-height: 1.7;
  margin: 0 0 1.75rem;
}

.algorithm-section {
  padding: 5rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.algorithm-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  margin-top: 2rem;
  align-items: start;
}

.algorithm-text h3 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  margin: 0 0 1rem;
  color: var(--ink);
}

.algorithm-text p {
  line-height: 1.6;
  color: var(--ink-muted);
  margin: 0 0 2rem;
}

.keyword-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.keyword {
  background: rgba(26, 26, 26, 0.05);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--ink);
}

/* 互动模拟器样式 */
.algorithm-interactive {
  background: var(--bg-paper);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 8px 24px rgba(26, 26, 26, 0.08);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sunlight-simulator,
.wall-simulator,
.earthquake-simulator,
.patio-simulator {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sunlight-building,
.wall-structure,
.earthquake-building {
  position: relative;
  height: 300px;
  background: rgba(26, 26, 26, 0.03);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.patio-structure {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 1rem;
  perspective: 1000px;
  background: rgba(26, 26, 26, 0.03);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

/* 日光算法模拟器 */
.sunlight-simulator {
  position: relative;
  min-height: 350px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

.sunlight-building {
  position: relative;
  width: 200px;
  height: 250px;
  margin: 0 auto;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.building-body {
  width: 100px;
  height: 180px;
  background: #d9b38c;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
  z-index: 2;
  position: relative;
}

.building-body::before {
  content: '';
  position: absolute;
  top: 40px;
  left: 20px;
  width: 20px;
  height: 60px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  z-index: 2;
}

.building-body::after {
  content: '';
  position: absolute;
  top: 40px;
  right: 20px;
  width: 20px;
  height: 60px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  z-index: 2;
}

.building-roof {
  width: 0;
  height: 0;
  border-left: 60px solid transparent;
  border-right: 60px solid transparent;
  border-bottom: 40px solid #8b4513;
  position: absolute;
  bottom: 180px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
}

.building-eaves {
  width: 150px;
  height: 15px;
  background: #8b4513;
  position: absolute;
  bottom: 170px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 2px;
  z-index: 4;
}

.sun {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: #ffcc00;
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(255, 204, 0, 0.8);
  z-index: 10;
  transition: all 0.5s ease;
}

.sun::after {
  content: '';
  position: absolute;
  top: -20px;
  left: -20px;
  right: -20px;
  bottom: -20px;
  background: radial-gradient(circle, rgba(255, 204, 0, 0.3) 0%, rgba(255, 204, 0, 0) 70%);
  border-radius: 50%;
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 0.8; }
}

.building-body::before {
  content: '';
  position: absolute;
  top: 40px;
  left: 20px;
  width: 20px;
  height: 60px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  z-index: 2;
}

.building-body::after {
  content: '';
  position: absolute;
  top: 40px;
  right: 20px;
  width: 20px;
  height: 60px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  z-index: 2;
}

.sunlight-indoor {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0; /* 需要修改为初始高度，如height: 30% */
  background: linear-gradient(to top, rgba(255, 204, 0, 0.3), rgba(255, 204, 0, 0));
  transition: all 0.5s ease;
  z-index: 1;
}

.sunlight-rays {
  position: absolute;
  top: 70px;
  right: 70px;
  width: 200px;
  height: 200px;
  z-index: 2; 
  pointer-events: none;
}

.sunlight-ray {
  position: absolute;
  top: 0;
  right: 0;
  width: 2px;
  height: 200px;
  background: linear-gradient(to bottom, rgba(255, 204, 0, 0.8), rgba(255, 204, 0, 0));
  transform-origin: top right;
  transition: all 0.5s ease;
}

.sunlight-ray:nth-child(1) { transform: rotate(30deg); }
.sunlight-ray:nth-child(2) { transform: rotate(45deg); }
.sunlight-ray:nth-child(3) { transform: rotate(60deg); }

/* 呼吸之墙模拟器 */
.wall-structure {
  flex-direction: row;
  gap: 10px;
  position: relative;
  height: 250px;
  align-items: center;
}

.wall-layer {
  width: 80px;
  height: 200px;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wall-exterior {
  background: #d9b38c;
  position: relative;
  overflow: hidden;
}

/* 热源 */
.heat-source {
  position: absolute;
  top: 50%;
  left: -20px;
  transform: translateY(-50%);
  width: 20px;
  height: 80px;
  background: linear-gradient(to right, #ff6b6b, #ff9e9e);
  border-radius: 10px 0 0 10px;
  box-shadow: 0 0 10px rgba(255, 107, 107, 0.8);
}

/* 热流 */
.heat-flow {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  overflow: hidden;
}

.heat-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: rgba(255, 107, 107, 0.8);
  border-radius: 50%;
  box-shadow: 0 0 5px rgba(255, 107, 107, 0.8);
  animation: heatFlow 3s linear infinite;
}

@keyframes heatFlow {
  0% {
    transform: translateX(0);
    opacity: 1;
  }
  100% {
    transform: translateX(100px);
    opacity: 0;
  }
}

.wall-cavity {
  background: rgba(255, 255, 255, 0.5);
  border: 1px dashed #999;
  transition: all 0.5s ease;
}

.wall-interior {
  background: #f5f5dc;
}

/* 砖墙纹理 */
.brick-pattern {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(rgba(0, 0, 0, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.1) 1px, transparent 1px);
  background-size: 20px 15px;
}

/* 空腔纹理 */
.cavity-pattern {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(circle, rgba(100, 149, 237, 0.3) 1px, transparent 1px);
  background-size: 15px 15px;
  transition: all 0.5s ease;
}

/* 隔热效果可视化 */
.wall-cavity.insulation {
  background: rgba(144, 238, 144, 0.5);
  border: 1px solid #90EE90;
}

.wall-cavity.insulation .cavity-pattern {
  background-image: 
    radial-gradient(circle, rgba(144, 238, 144, 0.6) 1px, transparent 1px);
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* 呼吸之墙注释样式 */
.wall-legend {
  margin-top: 1.5rem;
  padding: 1rem;
  background: rgba(26, 26, 26, 0.03);
  border-radius: 8px;
  font-size: 0.9rem;
}

.wall-legend h4 {
  margin: 0 0 0.8rem;
  font-size: 1rem;
  color: var(--ink);
}

.wall-legend ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.wall-legend li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 150px;
}

.wall-legend .legend-item {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  display: inline-block;
}

.wall-legend .legend-item.wall-exterior {
  background: #d9b38c;
}

.wall-legend .legend-item.wall-cavity {
  background: rgba(100, 149, 237, 0.3);
  border: 1px dashed #6495ED;
}

.wall-legend .legend-item.wall-interior {
  background: #f5f5dc;
}

.wall-legend .legend-item.heat {
  background: linear-gradient(to right, #ff6b6b, #ff9e9e);
}

/* 抗震模拟器 */
.earthquake-building {
  width: 200px;
  height: 200px;
  position: relative;
  transition: all 0.5s ease;
}

/* 木构架 */
.building-frame {
  width: 150px;
  height: 150px;
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.frame-pillar {
  width: 15px;
  height: 120px;
  background: #8b4513;
  position: absolute;
  bottom: 0;
}

.frame-pillar.left {
  left: 20px;
}

.frame-pillar.right {
  right: 20px;
}

.frame-beam {
  width: 110px;
  height: 15px;
  background: #8b4513;
  position: absolute;
  top: 30px;
  left: 20px;
}

/* 屋顶 */
.building-roof3 {
  width: 0;
  height: 0;
  border-left: 60px solid transparent;
  border-right: 60px solid transparent;
  border-bottom: 40px solid #8b4513;
  position: absolute;
  bottom: 140px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
}

/* 斗拱 */
.dougong {
  width: 25px;
  height: 25px;
  background: #a0522d;
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 2px;
  z-index: 4;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 墙体 */
.building-walls {
  width: 140px;
  height: 140px;
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
}

.wall {
  width: 40px;
  height: 120px;
  background: rgba(217, 179, 140, 0.7);
  position: relative;
  transition: all 0.5s ease;
}

.wall.cracked {
  background: rgba(217, 179, 140, 0.5);
  position: relative;
}

.wall.cracked::after {
  content: '';
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  background: linear-gradient(45deg, transparent 49%, #666 49%, #666 51%, transparent 51%),
              linear-gradient(-45deg, transparent 49%, #666 49%, #666 51%, transparent 51%);
  background-size: 10px 10px;
  opacity: 0.3;
}

/* 地震动画 */
.earthquake-building.shaking {
  animation: shake 0.5s ease-in-out infinite;
}

.earthquake-building.shaking .dougong {
  animation: dougongMove 0.5s ease-in-out infinite;
}

@keyframes shake {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  25% { transform: translateX(-50%) translateY(-2px) rotate(0.5deg); }
  50% { transform: translateX(-50%) translateY(0) rotate(-0.5deg); }
  75% { transform: translateX(-50%) translateY(-1px) rotate(0.5deg); }
}

@keyframes dougongMove {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  25% { transform: translateX(-48%) translateY(-1px); }
  50% { transform: translateX(-52%) translateY(1px); }
  75% { transform: translateX(-49%) translateY(-1px); }
}

/* 墙倒屋不坍注释样式 */
.earthquake-legend {
  margin-top: 1.5rem;
  padding: 1rem;
  background: rgba(26, 26, 26, 0.03);
  border-radius: 8px;
  font-size: 0.9rem;
}

.earthquake-legend h4 {
  margin: 0 0 0.8rem;
  font-size: 1rem;
  color: var(--ink);
}

.earthquake-legend ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.earthquake-legend li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 150px;
}

.earthquake-legend .legend-item {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  display: inline-block;
}

.earthquake-legend .legend-item.frame {
  background: #8b4513;
}

.earthquake-legend .legend-item.dougong {
  background: #a0522d;
  position: static;
  top: auto;
  left: auto;
  transform: none;
  width: 16px;
  height: 16px;
  box-shadow: none;/*AI辅助生成：Doubao-Seed-Code，Trae vscode插件，2026年4月25日21：55-22：00 */
}

.earthquake-legend .legend-item.wall {
  background: rgba(217, 179, 140, 0.7);
}

.earthquake-legend .legend-item.roof {
  background: #8b4513;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.patio-simulator {
  position: relative;
  min-height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

.patio-structure {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 1rem;
  perspective: 1000px;
  background: rgba(26, 26, 26, 0.03);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.patio-house {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto;
  transform-style: preserve-3d;
}

.patio {
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.8);
  border: 2px solid #d9b38c;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
}

.room {
  position: absolute;
  background: rgba(217, 179, 140, 0.7);
  border: 1px solid #d9b38c;
}

.room.left {
  width: 60px;
  height: 80px;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}

.room.right {
  width: 60px;
  height: 80px;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}

.room.front {
  width: 80px;
  height: 60px;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}

.room.back {
  width: 80px;
  height: 60px;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 0;
}

.air-flow {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 3;
}

/* 热空气粒子 */
.hot-air-particle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: rgba(255, 107, 107, 0.7);
  border-radius: 50%;
  box-shadow: 0 0 5px rgba(255, 107, 107, 0.8);
  animation: hotAirRise 3s linear infinite;
}

/* 冷空气粒子 */
.cold-air-particle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: rgba(100, 149, 237, 0.7);
  border-radius: 50%;
  box-shadow: 0 0 5px rgba(100, 149, 237, 0.8);
  animation: coldAirFlow 3s linear infinite;
}

/* 热空气上升动画 */
@keyframes hotAirRise {
  0% {
    transform: translateY(100px) translateX(0);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateY(-60px) translateX(0);
    opacity: 0;
  }
}

/* 冷空气流动动画 */
@keyframes coldAirFlow {
  0% {
    transform: translateX(-50px) translateY(0);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateX(50px) translateY(0);
    opacity: 0;
  }
}

/* 冷空气垂直流动动画 */
@keyframes coldAirFlowVertical {
  0% {
    transform: translateY(-50px) translateX(0);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateY(50px) translateX(0);
    opacity: 0;
  }
}

/* 天井拔风注释样式 */
.patio-legend {
  margin-top: 1.5rem;
  padding: 1rem;
  background: rgba(26, 26, 26, 0.03);
  border-radius: 8px;
  font-size: 0.9rem;
}

.patio-legend h4 {
  margin: 0 0 0.8rem;
  font-size: 1rem;
  color: var(--ink);
}

.patio-legend ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.patio-legend li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 150px;
}

.patio-legend .legend-item {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  display: inline-block;
}

.patio-legend .legend-item.patio {
  background: rgba(255, 255, 255, 0.8);
  border: 2px solid #d9b38c;
  position: static;
  top: auto;
  left: auto;
  transform: none;
  width: 16px;
  height: 16px;
  box-shadow: none;
}

.patio-legend .legend-item.room {
  background: rgba(217, 179, 140, 0.7);
  border: 1px solid #d9b38c;
  position: static;
  top: auto;
  left: auto;
  transform: none;
  width: 16px;
  height: 16px;
  box-shadow: none;
}

.patio-legend .legend-item.hot-air {
  background: rgba(255, 107, 107, 0.7);
  border-radius: 50%;
}

.patio-legend .legend-item.cold-air {
  background: rgba(100, 149, 237, 0.7);
  border-radius: 50%;
}

/* 控制按钮样式 */
.algorithm-interactive button,
.algorithm-interactive select {
  padding: 0.6rem 1.2rem;
  border: 1px solid rgba(26, 26, 26, 0.2);
  border-radius: 6px;
  background: white;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.algorithm-interactive button:hover,
.algorithm-interactive select:hover {
  background: rgba(26, 26, 26, 0.05);
}

.algorithm-interactive button:active {
  transform: translateY(1px);
}

/* 结果显示 */
.sunlight-result,
.wall-result,
.earthquake-result,
.patio-result {
  padding: 1rem;
  background: rgba(26, 26, 26, 0.03);
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--ink);
  min-height: 60px;
}

/* 响应式调整 */
@media (max-width: 1024px) {
  .algorithm-content {
    grid-template-columns: 1fr;
  }
  
  .algorithm-section {
    padding: 3rem 1.5rem;
  }
}

@media (max-width: 640px) {
  .algorithm-hero-content h1 {
    font-size: 2rem;
  }
  
  .algorithm-hero-content p {
    font-size: 1rem;
  }
  
  .algorithm-interactive {
    padding: 1.5rem;
  }
  
  .sunlight-building,
  .wall-structure,
  .earthquake-building,
  .patio-structure {
    height: 250px;
  }
}

/* 动画效果 */
@keyframes earthquake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@keyframes airflow {
  0% { opacity: 0; transform: translateY(0); }
  50% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-100px); }
}

/* 激活状态 */
.earthquake-active {
  animation: earthquake 0.5s ease-in-out infinite;
}

.wall-cracked {
  background: linear-gradient(45deg, rgba(217, 179, 140, 0.7) 0%, rgba(217, 179, 140, 0.3) 100%);
  position: relative;
}

.wall-cracked::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 49%, rgba(0, 0, 0, 0.3) 50%, transparent 51%);
  background-size: 10px 10px;
}

.airflow-active {
  animation: airflow 3s ease-in-out infinite;
}