* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: #0f172a;
  background-image: url("../images/background.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  display: flex;
}

/* 图片优化 */
img {
  max-width: 100%;
  height: auto;
  loading: lazy;
}

/* 预加载关键图片 */
.preload-bg {
  background-image: url("../images/background.jpg");
  background-size: 1px 1px;
  background-repeat: no-repeat;
  position: absolute;
  top: -9999px;
  left: -9999px;
}

::selection {
  background-color: #ffeb55;
  color: black;
}

.container {
  max-width: 1200px;
  margin-inline: auto;
  padding: 0 2rem;
}

.portfolio,
.previous-role {
  scroll-margin-top: 100px;
}

.client-experience,
.contact {
  scroll-margin-top: 150px;
}

h1,
h2 {
  font-family: "Libre Baskerville", serif;
}

p,
.nav-links li {
  font-family: "Poppins", sans-serif;
}

/* 导航栏样式 */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  max-width: 1200px;
  margin-inline: auto;
  padding-top: 2rem;
  padding: 2rem 2rem;
}

.logo img {
  width: 3rem;
  margin-left: -0.5rem;
  position: relative;
  transition: transform 0.3s ease;
}

.logo img:hover {
  transform: translateY(-3px);
}

.logo a {
  text-decoration: none;
}

.nav-right {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.toggle {
  display: none;
  font-size: 24px;
  color: white;
  cursor: pointer;
  position: relative;
  top: -8px;
}

.nav-links {
  display: flex;
  list-style: none;
  position: relative;
  gap: 3rem;
}

.nav-links a {
  font-weight: 600;
  color: white;
  text-decoration: none;
  position: relative;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 2px;
  background-color: white;
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.nav-links a:hover::after {
  transform: scaleX(1);
}

.hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  color: white;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.8rem);
  font-weight: 500;
  font-family: "Montserrat", sans-serif;
  margin: 0 auto;
  width: 80%;
  max-width: 100%;
  line-height: 1.3;
  color: #fff;
  text-align: center;
  position: relative;
  z-index: 2;
}

/* Hero Shapes */
.hero-shapes {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.shape {
  position: absolute;
  opacity: 0.7;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.3));
  animation: float 6s ease-in-out infinite;
}

.shape-cube {
  width: 96px;
  height: auto;
  top: 45%;
  left: 15%;
  animation-delay: 0s;
  transform: rotate(15deg);
}

.shape-cylinder {
  width: 96px;
  height: auto;
  top: 60%;
  right: 15%;
  animation-delay: 2s;
  transform: rotate(-10deg);
}

.shape-sphere {
  width: 96px;
  height: auto;
  top: 25%;
  right: 20%;
  animation-delay: 4s;
  transform: rotate(25deg);
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px) rotate(var(--rotation, 0deg));
  }
  50% {
    transform: translateY(-20px) rotate(var(--rotation, 0deg));
  }
}

.shape-cube {
  --rotation: 15deg;
}

.shape-cylinder {
  --rotation: -10deg;
}

.shape-sphere {
  --rotation: 25deg;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .shape {
    opacity: 0.5;
  }

  .shape-cube {
    width: 72px;
    height: auto;
    top: 40%;
    left: 8%;
  }

  .shape-cylinder {
    width: 72px;
    height: auto;
    top: 70%;
    right: 10%;
  }

  .shape-sphere {
    width: 72px;
    height: auto;
    top: 20%;
    right: 15%;
  }
}

.portfolio h2,
.previous-role h2,
.client-experience h2,
.contact h2,
.table-of-content h2 {
  color: white;
  font-size: 2rem;
}

.portfolio p,
.previous-role p,
.client-experience p,
.contact p,
.table-of-content p {
  font-size: 1.2rem;
  color: #8297bd;
  margin: 1rem 0;
  display: block;
}

/* Detail page specific styles - override global p width */
.portfolio-detail p {
  width: 100% !important;
  margin: 0 !important;
}

.dashed-line {
  border-top: 1.5px dashed #616b75;
  margin-bottom: 2.5rem;
}

.portfolio-link,
.portfolio-text h3 {
  text-decoration: none;
}

.portfolio-item {
  pointer-events: auto; /* 确保点击事件没有被禁用 */
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1.2rem;
}

/* Branding section specific styles */
#branding .portfolio-grid {
  grid-template-columns: repeat(2, 1fr);
  max-width: 800px;
  gap: 2rem;
}

#branding .portfolio-item {
  height: 450px;
  display: flex;
  flex-direction: column;
}

#branding .image-container {
  height: 200px;
  overflow: hidden;
  flex-shrink: 0;
}

#branding .image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#branding .portfolio-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 25px;
  justify-content: space-between;
}

#branding .portfolio-text h3 {
  margin-bottom: 5px;
  font-size: 1.5rem;
}

#branding .portfolio-item p {
  flex: 1;
  margin-top: 5px;
  font-size: 0.9rem;
  color: #ced4da;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
  max-height: calc(1.5em * 3);
  text-align: left;
}

#branding .tag-list {
  margin-top: auto;
  padding-top: 2px;
  min-height: 25px;
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-start;
}

/* Social Media Post section styles */
.social-media-grid {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.social-media-item {
  background-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
  color: white;
  border-radius: 15px;
  padding: 2.5rem;
  transition: filter 0.3s ease;
}

.social-media-item:hover {
  filter: brightness(1.1);
}

.category-title {
  font-size: 2rem;
  text-align: center;
  margin-bottom: 2rem;
  color: white;
}

.mockup-images {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}

.mockup-image {
  flex: 1;
  max-width: 300px;
  min-width: 250px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.mockup-image img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.info-sections {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  margin-top: 2rem;
}

.info-section {
  flex: 1;
  text-align: left;
}

.info-section h4 {
  font-size: 1.2rem;
  margin-bottom: 0.8rem;
  color: white;
  font-weight: 600;
  font-family: "Libre Baskerville", serif;
}

.info-section p {
  font-size: 0.9rem;
  color: white;
  line-height: 1.5;
  margin: 0;
  font-family: "Poppins", sans-serif;
  text-align: justify;
}

.portfolio-item {
  background-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
  color: white;
  border-radius: 10px;
  overflow: hidden;
  transition: filter 0.3s ease;
}

.portfolio-item:hover {
  filter: brightness(1.2);
}

.image-container {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.image-container img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

/* Mobile Landing Pages specific image sizing */
#mobile-landing-page .image-container {
  width: 100%;
  height: 200px;
  overflow: hidden;
}

#mobile-landing-page .image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 16/9;
}

/* Brand Design specific styling - wider cards for fewer items */
#branding .portfolio-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  #branding .portfolio-grid {
    grid-template-columns: 1fr;
  }
}

.portfolio-text {
  padding: 25px;
}

.portfolio-text h3,
.role-item h3 {
  font-size: 1.5rem;
}

.role-item h3 {
  margin-top: 10px;
}

.portfolio-item p {
  margin-top: 5px;
  font-size: 0.9rem;
  color: #ced4da;
  width: auto;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
  max-height: calc(1.5em * 3);
  text-align: left;
}

.tag-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag-item {
  background-color: #3b4d62;
  color: #03ffd5;
  padding: 5px 10px;
  border-radius: 25px;
  font-size: 0.8rem;
  font-weight: 500;
  display: inline-block;
}

.tag-item:hover {
  background-color: #1f2a36;
}

.portfolio {
  margin: 8rem 0;
}

.previous-role {
  min-height: 600px;
  margin: 10rem 0;
}

.role-item {
  padding: 1.8rem 2rem 0.9rem 2rem;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
  text-align: left;
  background-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
  color: white;
  display: flex;
  overflow: hidden;
  transition: filter 0.3s ease;
  justify-content: space-between;
}

.role-item:hover {
  filter: brightness(1.2);
}

.role-item .position {
  color: #3fdf90;
  font-weight: 500;
}

.role-item p {
  margin-top: 5px;
  font-size: 0.9rem;
  color: #ced4da;
  width: 100%;
}

.role-text {
  width: 60%;
}

.role-img img {
  margin-top: -15px;
  max-height: 12rem;
  object-fit: cover;
}

.client-experience {
  min-height: 625px;
}

.company-logo {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  list-style: none;
  gap: 1.5rem;
  margin-top: 6rem;
}

.company-logo img {
  height: 2.5rem;
  width: auto;
  flex-basis: calc(25% - 1.5rem);
  max-width: 100%;
  position: relative;
  transition: transform 0.3s ease;
}

.company-logo img:hover {
  transform: translateY(-5px);
}

.contact {
  min-height: 100vh;
  position: relative;
}

.contact p .design-detail {
  color: #5c6a85;
  font-weight: 400;
}

.contact .design-detail {
  position: absolute;
  top: 28rem;
  font-size: clamp(0.7rem, 2vw, 0.9rem);
  font-weight: 300;
}

.contact-link {
  text-decoration: none;
  color: #fff;
  position: relative;
}

.contact-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background-color: white;
}

.contact-link:hover::after {
  content: "";
}

.contact-logo {
  display: flex;
  list-style: none;
  gap: 2rem;
  position: absolute;
  top: 10rem;
}

.contact-logo img {
  width: 2rem;
  transition: filter 0.3s ease;
}

.contact-logo img:hover {
  filter: brightness(1.5);
}

.contact span {
  color: #e5e7eb;
}

@media (max-width: 1024px) {
  .company-logo img {
    flex-basis: calc(33.33% - 1rem);
    height: 2rem;
  }

  .portfolio p,
  .previous-role p,
  .client-experience p,
  .contact p {
    width: 80%;
    font-size: 0.95rem;
  }
}

@media (max-width: 768px) {
  .navbar ul {
    display: none;
    flex-direction: column;
    background-color: #0f172a;
    position: absolute;
    top: 100%;
    right: 0;
    width: 100%;
    text-align: center;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    width: 200px;
  }

  .nav-links li {
    margin: 1rem 0;
  }

  .nav-links a {
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 600;
    padding: 0.5rem 0;
  }

  .toggle {
    display: block;
  }

  .nav-links.show {
    display: flex;
  }

  .role-item {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .role-text {
    width: 100%;
    margin-bottom: 0.4rem;
  }

  .role-img img {
    height: auto;
    width: 100%;
    margin-top: 0;
    object-fit: contain;
  }

  .company-logo img {
    height: 1.5rem;
  }

  .portfolio p,
  .previous-role p,
  .client-experience p,
  .contact p {
    width: 90%;
    font-size: 0.9rem;
  }

  /* Branding responsive styles */
  #branding .portfolio-grid {
    grid-template-columns: 1fr;
    max-width: 100%;
    gap: 1.5rem;
  }

  #branding .portfolio-item {
    height: 380px;
  }

  #branding .image-container {
    height: 160px;
  }

  /* Social Media Post responsive styles */
  .social-media-grid {
    gap: 1.5rem;
  }

  .social-media-item {
    padding: 2rem;
  }

  .category-title {
    font-size: 1.8rem;
  }

  .mockup-images {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
  }

  .mockup-image {
    max-width: 280px;
    min-width: 200px;
  }

  .info-sections {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    text-align: left;
  }
}

@media (max-width: 480px) {
  .company-logo img {
    height: 1.5rem;
  }

  .portfolio p,
  .previous-role p,
  .client-experience p,
  .contact p {
    width: 100%;
    font-size: 0.85rem;
  }
}

html {
  scroll-behavior: smooth;
}

/* Table of Content Styles */
.table-of-content {
  scroll-margin-top: 100px;
  margin-bottom: 6rem;
}

.table-of-content .content-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
}

.content-item {
  padding: 1rem 0;
  transition: all 0.3s ease;
}

.content-item:hover {
  transform: translateY(-3px);
}

.content-item h3 {
  margin: 0;
}

.content-item h3 a {
  color: white;
  text-decoration: none;
  font-family: "Poppins", sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  transition: all 0.3s ease;
  display: inline-block;
  position: relative;
}

.content-item h3 a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 100%;
  height: 2px;
  background-color: white;
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.content-item h3 a:hover::after {
  transform: scaleX(1);
}

.content-item h3 a:hover {
  color: white;
}

.content-item h3 a:visited {
  color: white;
}

.content-item h3 a:active {
  color: white;
}

@media (max-width: 768px) {
  .table-of-content {
    padding: 2rem 1rem;
    margin: 1rem;
  }

  .table-of-content h2 {
    font-size: 1.8rem;
  }

  .content-item h3 a {
    font-size: 1.1rem;
  }
}
