/* Pattern Page Specific Styles */
/* layout_pattern.css
   Styles specific to pattern layout pages
   Author: Yu Liu
   Created: 2025-05-02
*/

body {
  font-family: "Roboto", sans-serif;
  background-color: #ffffff;
  margin: 0;
}

html,
body {
  overflow-x: hidden;
  overflow-y: scroll; /* 防止滚动条影响布局跳动 */
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  background-color: #ffffff;
  padding-left: 0; /* 移除整个页面容器的左内边距 */
}

.profile {
  display: block;
  margin: 0 auto;
  width: 100%; /* 填满容器宽度 */
  max-width: 600px; /* 限制最大宽度，防止过大 */
  height: auto;
  max-height: 400px;
  object-fit: contain; /* 保持比例 */
}

.section-subtitle {
  text-align: left;
  font-size: 1.4rem;
  font-weight: 600;
  text-align: left !important;
  color: #333; /* 或自定义颜色，如 #0055cc */
  margin-top: 0;
  margin-left: 0;
  margin-bottom: 1rem;
  font-family: "Roboto", sans-serif;
  border-left: 4px solid #008cff; /* 可选：加一点视觉引导 */
  padding-left: 0.6rem;
}

/* Pattern Navigation */
.pattern-nav {
  background-color: #f9f9f9;
  border-bottom: 1px solid #ccc;
  padding: 1rem 2rem;
  margin-bottom: 2rem;
}

.pattern-nav ul {
  list-style: none;
  display: flex;
  gap: 2rem;
  margin: 0;
  padding: 0;
}

.pattern-nav li a {
  text-decoration: none;
  font-weight: 500;
  color: #007bff;
  border-bottom: 2px solid transparent;
  padding-bottom: 4px;
  transition: border-color 0.2s;
}

.pattern-nav li a:hover {
  border-bottom: 2px solid #007bff;
}

/* Pattern Content Layout */
.pattern-content {
  padding: 1rem 2rem;
  color: #333;
  line-height: 1.6;
}

.summary-truncated {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;

  /* 标准写法，未来用于兼容 Firefox 和新标准 */
  line-clamp: 3;
  box-orient: vertical;

  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4em;
  max-height: 4.2em;
}

/* Text Truncation (if used in preview cards) */
.text-wrapper {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4em;
  max-height: 2.8em;
  text-overflow: ellipsis;

  white-space: normal;

  word-break: break-word; /* 自动断词 */
  overflow-wrap: anywhere; /* 优先换行 */
}

.full-text {
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
}

/* Expand/Collapse Button */
.show-more {
  color: #5e7400;
  cursor: pointer;
  font-size: 0.9rem;
  margin-top: 0.5rem;
  font-weight: bold;
}
.pattern-subnav {
  background: none;
  border: none;
  padding: 0;
}

.pattern-subnav .dropdown-menu {
  list-style: none;
  display: flex;
  gap: 2rem;
  margin: 0;
  padding: 0;
}

.pattern-subnav .dropdown {
  position: relative;
}

.pattern-subnav .dropdown span {
  cursor: pointer;
  font-weight: bold;
  color: #007bff;
}

.pattern-subnav .dropdown-content {
  display: none;
  position: absolute;
  background-color: white;
  border: 1px solid #ddd;
  padding: 0.5rem 1rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  z-index: 10;
}

.pattern-subnav .dropdown-content li {
  padding: 0.3rem 0;
}

.pattern-subnav .dropdown-content li a {
  text-decoration: none;
  color: #007bff;
  font-size: 0.95rem;
}

.pattern-subnav .dropdown:hover .dropdown-content {
  display: block;
}

.pattern-page-container {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 2rem;
  padding: 1rem;
}

/* 左侧导航栏 */
.pattern-sidebar {
  width: 200px;
  background: #ffffff;
  border-radius: 6px;
  padding: 1rem;
  position: sticky;
  top: 80px;
  height: max-content;
  padding-left: 0;
  margin-left: 0;
}

.pattern-subnav h3 {
  margin-top: 1rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid #ccc;
  font-size: 1rem;
  color: #2d72d9;
}
.pattern-list,
.pattern-list ul {
  list-style: none;
  padding-left: 0;
  margin-left: 0;
}

.pattern-category-group {
  margin-bottom: 0.9rem;
}

.pattern-category-group {
  margin-bottom: 1rem;
}

/* Category-level pattern */
.pattern-category-group > .category-link {
  display: block;
  font-weight: 600;
  font-size: 0.98rem;
  margin-top: 0.8rem;
  margin-bottom: 0.35rem;
  color: #111;
  text-decoration: none;
  border-left: 3px solid #2d72d9;
  padding-left: 0.45rem;
}

/* Application-level pattern list */
.application-pattern-list {
  list-style: none;
  margin: 0.25rem 0 0.8rem 0;
  padding-left: 0.9rem;
  border-left: 1px solid #ddd;
}

/* Application-level pattern item */
.application-pattern-list li {
  margin: 0.25rem 0;
}

.application-pattern-list a {
  display: inline-block;
  font-size: 0.9rem;
  color: #333;
  text-decoration: none;
  padding: 2px 5px;
  border-radius: 4px;
}

/* No dash; the grey vertical line already shows hierarchy */
.application-pattern-list a::before {
  content: "";
}

/* Hover effect */
.application-pattern-list a:hover,
.pattern-category-group > .category-link:hover {
  color: #004a99;
  background: #f2f6ff;
}

/* Active page */
.pattern-subnav a.active {
  background: #e6f0ff;
  color: #004a99;
  font-weight: 600;
  border-radius: 4px;
  padding: 2px 5px;
}
/* 主内容 */
.pattern-main-content {
  flex: 1;
  max-width: 800px;
}

/* =========================
   PATTERNS PAGE HERO
   ========================= */

.pattern-overview-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 4rem 2rem 6rem;
}

.patterns-hero {
  max-width: 900px;
  margin-bottom: 4.5rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid #ddd;
}

.patterns-eyebrow {
  margin: 0 0 1.25rem;
  color: #777;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.patterns-hero h1 {
  max-width: 820px;
  margin: 0;
  color: #222;
  font-size: clamp(2.4rem, 5vw, 3rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
  font-weight: 700;
}

.patterns-intro {
  max-width: 720px;
  margin: 2rem 0 0;
  color: #555;
  font-size: 1.05rem;
  line-height: 1.7;
}

.pattern-index-layout {
  padding: 0;
}

.patterns-overview-image {
  width: 100%;
  max-width: 800px;
  margin: 0 auto 4rem;
}

.patterns-overview-image img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
}

.patterns-hero {
  max-width: 900px;
  margin-bottom: 3rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid #ddd;
}

.patterns-eyebrow {
  margin: 0 0 1.25rem;
  color: #777;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.patterns-hero h1 {
  max-width: 820px;
  margin: 0;
  color: #222;
  font-size: clamp(2.4rem, 5vw, 3rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
  font-weight: 700;
}

.patterns-intro {
  max-width: 720px;
  margin: 2rem 0 0;
  color: #555;
  font-size: 1.05rem;
  line-height: 1.7;
}

.patterns-overview-image {
  max-width: 800px;
  margin: 0 auto 4rem;
}

.patterns-overview-image img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
}

.pattern-main-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem 0;
}

/* Card images should remain flush with the card */
.pattern-main-content .thumbnail img {
  margin: 0;
}

/* Introduction Section Layout */
.intro {
  display: flex;
  flex-direction: column;
  align-items: center; /* ⬅️ 关键：让子元素（如 .column）水平居中 */
  gap: 1.5rem;
  margin-top: 2rem;
  color: #333;
}

.intro-text {
  color: #333 !important;
}

.column {
  width: 100%;
  max-width: 800px; /* 自己控制最大宽度 */
  margin: 0 auto; /* 让整个块居中 */
}

.intro .column p,
.intro-text {
  color: #333 !important;
}

@media screen and (max-width: 800px) {
  .pattern-overview-page {
    padding: 3rem 1rem 4rem;
  }

  .patterns-hero {
    margin-bottom: 3rem;
    padding-bottom: 2.5rem;
  }

  .patterns-hero h1 {
    font-size: clamp(2.2rem, 8vw, 3rem);
  }

  .patterns-intro {
    font-size: 1rem;
  }

  .pattern-index-layout {
    padding: 0;
  }

  .patterns-overview-image {
    margin-bottom: 3rem;
  }
}

@media screen and (max-width: 800px) {
  .patterns-hero {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
  }

  .patterns-hero h1 {
    font-size: clamp(2.2rem, 8vw, 3rem);
  }

  .patterns-intro {
    font-size: 1rem;
  }

  .patterns-overview-image {
    margin-bottom: 3rem;
  }
  .intro {
    flex-direction: column;
    gap: 1rem;
  }
  .pattern-page-container {
    flex-direction: column;
    gap: 1rem;
  }

  .pattern-sidebar {
    width: 100%;
    position: static;
    border: none;
    border-bottom: 1px solid #ccc;
    border-radius: 0;
    background-color: #fafafa;
  }

  .pattern-main-content {
    max-width: 100%;
  }

  .pattern-subnav h3 {
    margin-top: 1rem;
  }

  .pattern-subnav ul {
    padding-left: 0.5rem;
  }
}
