/* ==========================================================================
   1. Fonts and Root Variables
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400..900;1,400..900&family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,700;1,8..60,400&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&family=Playfair+Display:ital,wght@0,400..900;1,400..900&display=swap');
@import url('https://fonts.google.com/css2?family=Inter:wght@100..900&family=Playfair+Display:ital,wght@0,400..900;1,400..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400..700;1,400..700&family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap');

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: fallback;
  src: url("../wp-content/themes/twentytwentyfive/assets/fonts/manrope/Manrope-VariableFont_wght.woff2") format("woff2");
}

:root {
  --font-family-heading: "Lora", "Times New Roman", serif;

  --font-family-base: "Inter", sans-serif;
  --font-family-mono: "Fira Code", monospace;
  --font-size-base: 16px;
  --font-size-sm: 0.875rem;
  --font-size-md: clamp(1rem, 1rem + ((1vw - 0.2rem) * 0.196), 1.125rem);
  --font-size-lg: clamp(1.125rem, 1.125rem + ((1vw - 0.2rem) * 0.392), 1.375rem);
  --font-size-xl: clamp(1.75rem, 1.75rem + ((1vw - 0.2rem) * 0.392), 2rem);
  --font-size-xxl: clamp(2.15rem, 2.15rem + ((1vw - 0.2rem) * 1.333), 3rem);

  --color-base: #ffffff;
  --color-contrast: #111111;
  --color-accent-2: #f6cff4;
  --color-accent-4: #686868;
  --color-primary: #5A67D8;
  /* Added for link consistency */

  --spacing-20: 10px;
  --spacing-30: 20px;
  --spacing-50: clamp(10px, 3vw, 25px);
  --spacing-60: clamp(20px, 4vw, 40px);
  --spacing-80: clamp(70px, 10vw, 140px);
  --spacing-xxl: 6rem;

  --max-width-wide: 1600px;
  --transition-fast: 150ms ease-in-out;
  --border-radius: 12px;
}

/* ==========================================================================
   2. Global Resets and Base Styles (FINAL FONT FIX)
   ========================================================================== */

/* ... (*, html, etc. remain the same) ... */

body {
  margin: 0;
  /* ★★★ 默认所有文字都使用 Montserrat ★★★ */
  font-family: var(--font-family-base);

  line-height: 1.7;
  font-weight: 400;
  /* Montserrat 的常规字重 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  background-color: var(--color-base);
  color: var(--color-contrast);
}

img,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

video {
  width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

p {
  margin: 0;
}

p+p {
  margin-top: var(--spacing-20);
}

/* 
  ★★★ 关键：确保所有标题都使用 Playfair Display ★★★
  这个规则应该放在 body 规则的后面
*/
h1,
h2,
h3,
h4,
h5,
h6,
.site-title,
.about-name,
.card__title,
.research-category__title,
.footer-nav__title {
  font-family: var(--font-family-heading);
  font-weight: 700;
  /* Lora 的 700 (Bold) 字重效果很好 */
}

/* 
  ★★★ 关键：确保列表项也使用正文字体 ★★★
  为了保险起见，我们再次明确定义
*/
.feature-list li {
  font-family: var(--font-family-base);
}

/* ==========================================================================
     3. Main Layout Components
     ========================================================================== */

.site-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-main {
  flex: 1;
}

.site-header {
  background-color: transparent;
  position: absolute;
  width: 100%;
  z-index: 10;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

body:not(.homepage) .site-header {
  position: static;
  background-color: #FFFFFF;
  border-bottom: 1px solid #EAEAEA;
}

.site-header--transparent {
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: fixed;
  border-bottom: 1px solid #EAEAEA;
}

.site-header__inner {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 1rem clamp(var(--spacing-30), 5vw, var(--spacing-80));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-50);
}

.site-title {
  font-size: var(--font-size-xxl);
  font-weight: 700;
}

.site-logo {
  display: block;
  max-width: 120px;
}

.site-logo img {
  width: 100%;
  height: auto;
  display: block;
}

.section {
  padding-block: var(--spacing-60);
}

.layout-wide {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding-inline: clamp(var(--spacing-30), 5vw, var(--spacing-80));
}

.layout-full-bleed {
  width: 100%;
  max-width: 100%;
  padding-inline: 0;
  text-align: center;
}

.section-title {
  margin: 0 0 var(--spacing-50);
  text-align: center;
  font-size: var(--font-size-xl);
  font-weight: 700;
}

.section--light-gray {
  background-color: #F7F9FA;
}

.site-footer {
  background-color: #f5f5f5;
}

.site-footer__inner {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: var(--spacing-60) clamp(var(--spacing-30), 5vw, var(--spacing-80));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-50);
}

.footer-nav {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-20);
}

.footer-nav__title {
  margin: 0;
  font-size: var(--font-size-lg);
  font-weight: 700;
}

.footer-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--spacing-20);
}

/* ==========================================================================
     4. Reusable Components
     ========================================================================== */

/* --- Split Layout --- */
.split {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-50);
  align-items: center;
  margin-top: var(--spacing-50);
}

.split--align-top {
  align-items: flex-start;
}

.split__media,
.split__content {
  flex: 1 1 320px;
  min-width: 0;
}

.split--reverse {
  flex-direction: row-reverse;
}

.split__content--align-right {
  text-align: right;
  align-items: flex-end;
}

.split__content--align-left {
  text-align: left;
  align-items: flex-start;
}

.split__content--align-middle {
  text-align: center;
  align-items: center;
}

/* --- Buttons --- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  font-size: var(--font-size-sm);
  font-weight: 600;
  padding: 1rem 2.25rem;
  transition: background-color var(--transition-fast);
}

.button--outline {
  background: transparent;
  border: 1px solid currentColor;
  padding: calc(1rem - 1px) calc(2.25rem - 1px);
}

.button--outline:hover {
  background-color: color-mix(in srgb, var(--color-contrast) 5%, transparent);
}

.split__content .button {
  margin-top: 1rem;
}

.button--primary {
  background-color: var(--color-primary);
  color: #FFFFFF;
  border: none;
  font-weight: 700;
}

.button--primary:hover {
  background-color: color-mix(in srgb, var(--color-primary) 85%, black);
  text-decoration: none;
}

/* --- Galleries --- */
.inline-gallery {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 1.5rem;
}

.inline-gallery__item {
  margin: 0;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 8px;
}

.inline-gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-gallery {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(6, 1fr);
}

.thumb-gallery__item {
  display: block;
  margin: 0;
  aspect-ratio: 3 / 4;
  border-radius: var(--border-radius);
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.thumb-gallery__item:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.1);
}

.thumb-gallery__item--landscape {
  aspect-ratio: 4 / 3;
}

.thumb-gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}


/* ==========================================================================
     5. UNIFIED & TARGETED MEDIA STYLES (FINAL VERSION)
     ========================================================================== */

/* --- General Frame Styling --- */
.media-frame,
.video-container {
  margin: 0 auto;
  width: 100%;
  border-radius: var(--border-radius);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.media-frame img,
.media-frame video {
  width: 100%;
  height: auto;
  display: block;
}

.video-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* --- Sizing for items INSIDE a .split layout --- */
.split .media-frame,
.split .video-container {
  max-width: 640px;
}

.has-uniform-media .split .media-frame img,
.has-uniform-media .split .media-frame video {
  width: 100%;
  height: auto;
}

/* --- Exception for Portrait Posters --- */
.split .media-frame--portrait {
  max-width: 380px;
  aspect-ratio: auto;
}

.split .media-frame--portrait img {
  max-height: 70vh;
  height: auto;
  object-fit: contain;
}

/* ==========================================================================
     6. Plugins Specific Styles (Swiper, lightGallery)
     ========================================================================== */

/* --- Swiper --- */
.swiper {
  overflow: hidden;
  border-radius: var(--border-radius);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.swiper-slide {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #f0f0f0;
}

.swiper-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.community-service-slider {
  width: 100%;
  max-width: 1500px;
  height: 420px;
  margin-left: auto;
  margin-right: auto;
}

.community-service-slider .swiper-button-next,
.community-service-slider .swiper-button-prev {
  color: #ffffff;
}

.community-service-slider .swiper-pagination-bullet-active {
  background-color: #ffffff;
}

.chess-volunteer-slider {
  width: 100%;
  height: 420px;
}

.chess-volunteer-slider .swiper-button-next,
.chess-volunteer-slider .swiper-button-prev {
  color: #333;
}

.chess-volunteer-slider .swiper-pagination-bullet-active {
  background-color: #333;
}

/* --- lightGallery --- */
.lg-image {
  max-width: 80% !important;
  max-height: 80vh !important;
}

/* ==========================================================================
     7. Animation Styles
     ========================================================================== */

.fade-in-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.8s ease-out;
}

.fade-in-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
     8. Page Specific Styles
     ========================================================================== */

/* --- Homepage Hero Section (CORRECTED SPLIT LAYOUT) --- */
.hero-section-home {
  /* 1. 将整个区域设置为一个 flex 容器 */
  display: flex;
  align-items: center;
  /* 2. 关键：让左右两个子元素（图片和文字背景）高度相等 */

  /* 3. 为其设置最大宽度和居中，并留出与顶部导航栏的距离 */
  margin: 0 auto;
  /* 这个值可以根据导航栏实际高度微调 */
  padding-top: var(--spacing-60);
  padding-bottom: var(--spacing-60);
}

.hero-section__background {
  /* 图片容器的样式 */
  flex: 1 1 70%;
  /* 分配宽度比例 */
  min-width: 0;
  height: 55vh;
}

.hero-section__background img {
  /* 图片本身的样式 */
  height: 100%;
  /* 1. 关键：强制图片高度撑满其容器 */
  object-fit: cover;
  /* 2. 关键：保持图片比例，自动裁剪多余部分（这里是左右两侧）*/
  display: block;
}

.hero-section__content-below {
  /* 文字容器的样式 */
  flex: 1 1 30%;
  /* 分配宽度比例 */
  background-color: #111111;
  /* 设置深色背景 */
  color: #FFFFFF;

  /* 使用 flex 让内部的文字块垂直居中 */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;

  padding: clamp(2rem, 6vw, 4rem);
  /* 设置内部的文字边距 */
  box-sizing: border-box;
}

/* --- 下面是文字部分的样式，基本保持不变 --- */
.hero-section__content-below .layout-wide {
  padding-inline: 0;
  width: 100%;
  max-width: 100%;
}

.hero-title-below {
  line-height: 1.3;
  max-width: 100%;
  margin: 0;
  font-weight: 700;
  font-size: clamp(1rem, 2vw, 2.5rem);
  /* 调整了字体大小以适应容器 */
  text-align: left;
}

.hero-title-below span {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 1rem;
}

.hero-title-below span::before {
  content: '';
  display: block;
  width: 40px;
  height: 1px;
  background-color: rgba(255, 255, 255, 0.5);
  margin-right: 1rem;
  /* 线条与文字的右边距 */
}

.hero-title-below span::after {
  content: '';
  /* ★ 关键：必须有 content 才能显示 */
  display: block;
  width: 40px;
  height: 1px;
  background-color: rgba(255, 255, 255, 0.5);
  margin-left: 1rem;
  /* ★ 关键：修改为 margin-left，实现对称 */
}

/* --- "About Me" Section --- */
.split .about-image-frame {
  max-width: 350px;
  /* ★★★ 从 450px 缩小到 380px ★★★ */
  border-radius: 16px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.about-name {
  font-size: var(--font-size-xl);
  font-weight: 800;
  margin: 0;
}

.about-tagline {
  font-size: var(--font-size-md);
  color: var(--color-accent-4);
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
  max-width: 55ch;
}

.feature-list {
  /* 
      我们不再需要 list-style: none;
      padding-left 给了圆点和左侧边缘之间的空间
    */
  padding-left: 1.5rem;
  /* 约 24px */
  margin: 0 0 2rem;

  /* 移除 grid 布局，回归标准的列表流 */
}

.feature-list li {
  /* 
      为每个列表项的下方增加一点间距，让列表不那么拥挤
    */
  margin-bottom: 0.5rem;
  /* 约 8px */
  padding-left: 0.5rem;
  /* ★★★ 关键：在圆点和文字之间创建空间 ★★★ */
  font-weight: 500;
}

/* --- "Research & Essays" Section --- */
.section-header {
  text-align: start;
}

.section-header__primary {
  font-weight: 800;
  margin: 0;
  font-size: 2em;
}

.section-header__secondary {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--color-accent-4);
  margin-bottom: 0.5rem;
}

.research-category {
  padding-top: 4rem;
}

.research-category:first-of-type {
  padding-top: 0;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.card {
  background-color: var(--color-base);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.1);
}

.card__image-wrapper {
  margin: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.card__image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 1rem;
}

.card__links {
  margin-top: auto;
  padding-top: 1rem;
  display: flex;
  gap: 1rem;
}

.card__links a {
  font-weight: 600;
  text-decoration: none;
  color: var(--color-primary);
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
  transition: border-color 0.2s ease;
}

.card__links a:hover {
  border-bottom-color: var(--color-primary);
}

.research-category .split h4 {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin: 0 0 1rem;
}

/* --- Sub-page Styles --- */
.subpage-hero {
  padding-block: 4rem;
  text-align: center;
}

.subpage-title {
  font-size: var(--font-size-xl);
  font-weight: 800;
  margin: 0 0 1rem;
}

.section-subtitle {
  text-align: center;
  font-size: var(--font-size-md);
  color: var(--color-accent-4);
  max-width: 60ch;
  margin: 0 auto 2rem;
}

.page-title {
  font-size: var(--font-size-xl);
  font-weight: 800;
  text-align: center;
  margin-bottom: 2rem;
  line-height: 1.2;
}

.page-title+.section-lead {
  margin-top: 2rem;
}

.layout-content {
  max-width: 1024px;
}

.layout-content h2 {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin-top: 3rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--color-accent-2);
  padding-bottom: 0.5rem;
}

.layout-content p {
  margin-bottom: 1rem;
}

.full-width-image {
  width: 100vw;
  max-width: 1200px;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  margin-block: 2rem;
  border-radius: var(--border-radius);
  overflow: hidden;
}

.full-width-image figcaption {
  font-size: var(--font-size-sm);
  color: var(--color-accent-4);
  text-align: center;
  margin-top: 0.5rem;
}

.media-gallery {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-block: 2rem;
}

.media-gallery__item {
  flex-basis: calc(33.333% - 1rem);
  flex-grow: 1;
  display: block;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.media-gallery__item:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.1);
}

.media-gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-gallery a[href*="youtube.com"]::after,
.media-gallery a[href*="youtu.be"]::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0' 0 24 24' fill='white'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
  background-size: 24px;
  background-position: center;
  background-repeat: no-repeat;
  transition: transform 0.2s ease, background-color 0.2s ease;
  pointer-events: none;
}

.media-gallery a[href*="youtube.com"]:hover::after,
.media-gallery a[href*="youtu.be"]:hover::after {
  transform: translate(-50%, -50%) scale(1.1);
  background-color: rgba(0, 0, 0, 0.7);
}

/* --- Team Members Grid --- */
.team-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3rem;
  margin-top: 2rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.team-member {
  text-align: center;
}

.team-member img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 1rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.team-member__info {
  display: flex;
  flex-direction: column;
}

.team-member__info strong {
  font-weight: 700;
}

.team-member__info span {
  font-size: var(--font-size-sm);
  color: var(--color-accent-4);
}

/* --- Image Grid 1+3 --- */
.image-grid-1plus3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  width: 100%;
}

.image-grid-1plus3 .image-grid__main {
  grid-column: 1 / 4;
  border-radius: 8px;
  overflow: hidden;
}

.image-grid-1plus3 .image-grid__main img {
  width: 100%;
  height: auto;
  max-height: 60vh;
  display: block;
}

.image-grid-1plus3 .image-grid__thumb {
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
}

.image-grid-1plus3 .image-grid__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- Featured Media Grid --- */
.featured-media-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-block: 2rem;
}

.featured-media__item {
  display: block;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.featured-media__item:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.1);
}

.featured-media__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.featured-media__item--view-all {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #f0f4ff;
  color: var(--color-primary);
  font-weight: 700;
}

.featured-media__item--view-all span {
  font-size: 2rem;
}

.featured-media__item--view-all small {
  font-size: 0.875rem;
}

.featured-media__item--video::after,
.featured-media__item[data-src]::after {
  content: none;
}


/* ==========================================================================
     11. Responsive Media Queries
     ========================================================================== */

@media (max-width: 1024px) {

  .site-header__inner,
  .site-footer__inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 900px) {
  .hero-section-home {
    flex-direction: column;
    /* 在小屏幕上，从左右布局变为上下堆叠 */
    padding-top: 80px;
    align-items: stretch;
    /* 确保宽度撑满 */
  }

  .hero-section__background {
    height: 50vh;
    flex-basis: auto;
  }

  .hero-section__content-below {
    flex-basis: auto;
    min-height: 50vh;
    align-items: center;
    text-align: center;
  }

  .hero-title-below span {
    justify-content: center;
  }

  .split {
    flex-direction: column;
    align-items: stretch;
  }

  .split__content,
  .split__content--align-right {
    align-items: flex-start;
    text-align: left;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .media-gallery__item {
    flex-basis: calc(50% - 0.5rem);
  }
}

@media (max-width: 600px) {
  .team-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .thumb-gallery {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  .media-gallery__item {
    flex-basis: 100%;
  }

  .thumb-gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
     12. Call to Action (CTA) Box for Links
     ========================================================================== */

.cta-box {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background-color: #f0f4ff;
  padding: 2rem;
  border-radius: var(--border-radius);
  margin-top: 3rem;
  text-decoration: none;
  color: var(--color-contrast);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cta-box:hover {
  text-decoration: none;
  transform: translateY(-5px);
  box-shadow: 0 12px 25px rgba(89, 103, 216, 0.15);
}

.cta-box__icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  color: var(--color-primary);
}

.cta-box__text {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
}

.cta-box__arrow {
  margin-left: auto;
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-primary);
  transition: transform 0.2s ease;
}

.cta-box:hover .cta-box__arrow {
  transform: translateX(5px);
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  /* ★★★ 关键：让网格的行高度自动调整 ★★★ */
  grid-auto-rows: 1fr;
}

.content-grid__item {
  display: grid;
  gap: 1.5rem;
  grid-template-rows: auto 1fr;
}

.content-grid .split__media {
  flex: 0 0 40%;
}

.content-grid .split__content {
  flex: 1;
}

.content-grid__item-body {
  display: flex;
  flex-direction: column;
}

.content-grid__item-body h3 {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin: 0;
}

.content-grid__item-body p {
  color: var(--color-accent-4);
  font-size: var(--font-size-sm);
  margin-top: 0.5rem;
  flex-grow: 1;
}

.content-grid__item-body .button {
  justify-self: start;
  margin-top: 1.5rem;
}

/* ==========================================================================
   14. EXCEPTION FOR PORTRAIT FRAMES (FINAL & CORRECTED SELECTOR)
   ========================================================================== */

/* 
  ★★★ 关键：使用更具体的选择器来提高优先级 ★★★
  这个规则现在和 .has-uniform-media 规则一样具体了
*/
.has-uniform-media .split .media-frame--portrait {
  /* 覆盖掉 16:9 的比例 */
  aspect-ratio: auto;

  /* 覆盖掉 .split__media 的 flex-basis: 40% */
  /* 我们不再需要 !important 了 */
  flex-basis: 35%;
  max-width: 380px;
  /* 给一个更合适的最大宽度 */
}

/* 
  这条规则确保竖向海报内部的图片能完整显示
  选择器也变得更具体
*/
.has-uniform-media .split .media-frame--portrait img {
  height: auto;
  object-fit: contain;
  max-height: 70vh;
  /* 限制最大高度 */
}

/* ==========================================================================
   X. PLAY ICON OVERLAY FOR VIDEO LINKS (FINAL FIX)
   ========================================================================== */

/* 
  确保 .media-gallery__item 是一个定位上下文，
  这样我们才能把图标精确定位在它的正中间。
*/
.media-gallery__item {
  position: relative;
  /* ★★★ 确保这一行存在 ★★★ */
}

/* 
  为所有指向 YouTube 的链接添加一个播放图标伪元素
*/
.media-gallery a[href*="youtube.com"]::after,
.media-gallery a[href*="youtu.be"]::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  width: 50px;
  height: 50px;

  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 50%;

  /* 这是嵌入式的 SVG 三角形图标 */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
  background-size: 24px;
  background-position: center;
  background-repeat: no-repeat;

  transition: transform 0.2s ease, background-color 0.2s ease;
  pointer-events: none;
  /* 确保图标不会干扰对链接的点击 */
  opacity: 0.8;
  /* 让图标稍微半透明，不那么突兀 */
}

/* 鼠标悬停时，图标变大、背景变深 */
.media-gallery a[href*="youtube.com"]:hover::after,
.media-gallery a[href*="youtu.be"]:hover::after {
  transform: translate(-50%, -50%) scale(1.1);
  background-color: rgba(0, 0, 0, 0.7);
  opacity: 1;
}

/* ==========================================================================
   X. About Me (me.html) Page Specific Styles
   ========================================================================== */

/* --- 2-Column Image Grid for "My Background" --- */
.image-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* 精确的两列 */
  gap: 1.5rem;
  /* 图片之间的间距 */
  margin-block: 2rem;
  /* 与上下文的间距 */
}

.image-grid-2col .media-frame {
  margin: 0;
  /* 移除 .media-frame 的默认 auto margin */
}

/* 调整子页面中 H3 标题的样式 */
.layout-content h3 {
  font-size: 1.5rem;
  /* 24px */
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

/* ==========================================================================
   X. Scrolling Gallery Component
   ========================================================================== */

.scrolling-gallery {
  display: flex;
  /* ★★★ 关键：使用 Flexbox 让图片横向排列 ★★★ */
  gap: 1rem;
  /* 图片之间的间距 */

  /* 创建一个可以横向滚动的容器 */
  overflow-x: auto;
  /* ★★★ 关键：允许内容在 X 轴（水平）上滚动 ★★★ */
  -webkit-overflow-scrolling: touch;
  /* 在移动端实现平滑的滚动效果 */

  /* 为滚动区域增加一点内边距，让图片不紧贴边缘 */
  padding: 0.5rem;

  /* 美化滚动条 (在支持的浏览器中) */
  scrollbar-width: thin;
  scrollbar-color: #ccc #f0f0f0;
}

.scrolling-gallery::-webkit-scrollbar {
  height: 8px;
  /* 滚动条高度 */
}

.scrolling-gallery::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 4px;
}

.scrolling-gallery::-webkit-scrollbar-thumb {
  background-color: #ccc;
  border-radius: 4px;
}

/* 
    为画廊中的每个项目（图片）设置尺寸
  */
.scrolling-gallery__item {
  flex-shrink: 0;
  /* ★★★ 关键：防止图片被压缩变形 ★★★ */

  /* 设置一个固定的高度，宽度自适应 */
  height: 250px;
  /* 你可以根据喜好调整这个高度 */

  border-radius: var(--border-radius, 12px);
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.scrolling-gallery__item:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.1);
}

.scrolling-gallery__item img {
  height: 100%;
  width: auto;
  /* ★★★ 关键：宽度自动，保持原始比例 ★★★ */
  display: block;
}

/* ==========================================================================
   X. Full Bleed Gallery Component
   ========================================================================== */

.full-bleed-gallery {
  width: 60vw;
  position: relative;
  left: 50%;
  transform: translateX(-50%);

  max-width: none;
  margin-block: 3rem;

  /* ★★★ 关键：在这里添加左右内边距 ★★★ */
  padding-inline: 2rem;
  /* 左右各留出 32px 的空白 */
}

/* ==========================================================================
   X. Background Slider (me.html)
   ========================================================================== */

.background-slider {
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 500px;
  /* 同时给一个最大高度限制 */
  border-radius: var(--border-radius, 12px);
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.background-slider .swiper-slide {
  /* 移除 slide 自身的背景色，让父容器的背景色透出来 */
  background-color: transparent;
}

.background-slider .swiper-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* 调整导航按钮和分页器的颜色 */
.background-slider .swiper-button-next,
.background-slider .swiper-button-prev {
  color: #333;
  /* 白色按钮 */
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.background-slider:hover .swiper-button-next,
.background-slider:hover .swiper-button-prev {
  opacity: 1;
}

.background-slider .swiper-pagination-bullet-active {
  background-color: #ffffff;
}

/* ==========================================================================
   X. LEAD PARAGRAPH STYLE
   ========================================================================== */

.section-lead {
  /* ★ 尺寸：比普通段落大，比小标题小 ★ */
  font-size: 1.25rem;
  /* 约 20px */

  /* ★ 字重：使用常规字重，与普通段落区分开 */
  font-weight: 400;

  /* ★ 颜色：比灰色段落更深，接近标题颜色 ★ */
  color: var(--color-contrast);

  /* ★ 布局：居中并限制最大宽度，提升阅读感 ★ */
  max-width: 75ch;
  /* 限制行长在 75 个字符左右，这是最佳阅读宽度 */
  margin-left: auto;
  margin-right: auto;

  /* ★ 间距：与下方的卡片网格拉开距离 ★ */
  margin-bottom: 3rem;
}

/* ==========================================================================
   X. 3-COLUMN FIXED CARD GRID
   ========================================================================== */

/* 
  这个新规则只对被标记了 .card-grid--3-col 的网格生效
*/
.card-grid--3-col {
  /* ★★★ 关键：精确设置为 3 个等宽的列 ★★★ */
  grid-template-columns: repeat(3, 1fr);
}

/* 
  响应式优化：在小屏幕上，让它变回单列，
  以避免卡片被挤得过小。
*/
@media (max-width: 768px) {
  .card-grid--3-col {
    grid-template-columns: 1fr;
    /* 在平板和手机上变为单列 */
  }
}