:root {
  --slate-950: #020617;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --white: #ffffff;
  --cyan-400: #22d3ee;
  --cyan-500: #06b6d4;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --purple-400: #c084fc;

  --cyan-alpha-10: rgba(6, 182, 212, 0.1);
  --cyan-alpha-20: rgba(6, 182, 212, 0.2);
  --cyan-alpha-50: rgba(6, 182, 212, 0.5);
  --slate-bg-dark: #0d1325;
  --hover-cyan: #0891b2;
  --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 0 15px rgba(6, 182, 212, 0.25);
}

html,
body {
  background-color: var(--slate-950);
  color: var(--white);
  font-family: "Inter", sans-serif;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
}

* {
  box-sizing: border-box;
}

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 1rem 0;
  background-color: rgba(2, 6, 23, 0.8);
  backdrop-filter: blur(10px);
  z-index: 1000;
  border-bottom: 1px solid var(--slate-800);
  transition: top 0.3s;
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  color: var(--white);
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: 700;
}

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

.nav-link {
  color: var(--gray-300);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.nav-link:hover {
  color: var(--cyan-400);
}

.nav-toggle {
  display: none;
  cursor: pointer;
  width: 24px;
  height: 18px;
  flex-direction: column;
  justify-content: space-between;
}

.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--white);
  border-radius: 2px;
  transition: all 0.3s ease-in-out;
}

.nav-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}
.nav-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: 10;
}

span {
  color: var(--white);
}

.job-title-wrapper {
  display: inline-block;
  vertical-align: bottom; /* 確保與後方文字對齊 */
  height: 1.2em; /* 設定一個高度以隱藏超出範圍的文字 */
  overflow: hidden;
  position: relative;
}
.job-title {
  display: inline-block;
  position: relative;
}

.floating-icon,
.icon,
.icon-md,
.icon-lg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}


.icon {
  width: 1rem;
  height: 1rem;
}
.icon-md {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--white);
}
.icon-lg {
  width: 2.5rem;
  height: 2.5rem;
  display: inline-block;
}

.hero-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background-color: var(--slate-950);
}

.hero-title {
  font-size: 3.75rem;
  font-weight: 900;
  margin-top: -7rem;
  margin-bottom: 5rem;
  background: linear-gradient(
    to right,
    var(--cyan-400),
    var(--blue-400),
    var(--purple-400)
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: -2rem;
}

.hero-buttons .icon{
  margin-right: 0.5rem;
  display: inline-block;
  vertical-align: middle;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2rem;
  border-radius: 9999px;
  font-weight: 500;
  font-size: 1.125rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(to right, var(--cyan-500), var(--blue-500));
  color: var(--white);
  box-shadow: var(--shadow-card);
}
.btn-primary:hover {
  background: linear-gradient(to right, var(--hover-cyan), #2563eb);
  box-shadow: var(--shadow-hover);
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--cyan-alpha-50);
  color: var(--cyan-400);
}
.btn-outline:hover {
  background-color: var(--cyan-alpha-10);
}

.floating-icons-container {
  position: absolute;
  bottom: 4rem;
  left: 0;
  right: 0;
  height: 150px;
  pointer-events: none;
  z-index: 1;
  contain: layout style paint;
}
.floating-icon {
  position: absolute;
  width: 2rem;
  height: 2rem;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}
.icon-code {
  top: 20px;
  left: 10%;
  color: rgba(34, 211, 238, 0.8);
}
.icon-database {
  top: 40px;
  right: 15%;
  color: rgba(96, 165, 250, 0.8);
}
.icon-smartphone {
  bottom: 40px;
  left: 15%;
  color: rgba(192, 132, 252, 0.8);
}
.icon-server {
  bottom: 20px;
  right: 10%;
  color: rgba(34, 211, 238, 0.8);
}

.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  animation: bounce 2s infinite;
}
.scroll-indicator .icon {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--gray-400);
}
@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translate(-50%, 0);
  }
  40% {
    transform: translate(-50%, 10px);
  }
  60% {
    transform: translate(-50%, 5px);
  }
}

.hero-doodo {
  position: absolute;
  right: 0%;
  top: 70px;
  width: min(450px, 40vw);
  height: min(600px, 60vh);
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.doodo-background {
  z-index: 1;
  position: absolute;
  top: -27%;
  left: 10%;
  width: 97%;
  height: 97%;
  will-change: transform;
  transform: translate3d(0, 0, 0);
  object-fit: contain;
  contain: layout style paint;
}
.doodo-person {
  z-index: 2;
  position: absolute;
  top: 10%;
  right: 20%;
  left: 0;
  width: 80%;
  height: 80%;
  object-fit: contain;
  pointer-events: none;
}
#about .container {
  grid-template-columns: 1fr 2fr;
}

.profile-card {
  position: relative;
  padding: 2rem;
  border-radius: 1rem;
  background-color: var(--slate-bg-dark);
  overflow: hidden;
  text-align: center;
}

.profile-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 1rem;
  padding: 2px;
  background: linear-gradient(
    135deg,
    var(--cyan-400),
    var(--slate-800),
    var(--slate-800)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: destination-out;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

.profile-img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 1.5rem auto;
  border: 3px solid var(--cyan-400);
  display: block;
}

.profile-tagline {
  font-size: 1rem;
  color: var(--gray-300);
  margin-bottom: 1.5rem;
  font-weight: 400;
}

.profile-tags {
  margin-bottom: 2rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.profile-tag {
  background-color: var(--slate-800);
  color: var(--gray-300);
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--slate-700);
}

.stats {
  text-align: center;
  margin-bottom: 2rem;
  color: var(--gray-300);
  font-size: 1rem;
  line-height: 1.6;
}

.stats p {
  margin: 0.5rem 0;
}

.stats p strong {
  color: var(--white);
  font-size: 1.1rem;
  font-weight: 700;
}

.about-text h3 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 1.5rem;
  color: var(--white);
}

.about-text p {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--gray-300);
  margin-bottom: 1.5rem;
}

.content-section {
  padding: 4rem 0;
  position: relative;
  background-color: var(--slate-900);
  width: 100%;
  overflow: hidden;
}
.content-section.dark {
  background-color: var(--slate-950);
}
.section-header {
  text-align: center;
  margin-bottom: 4rem;
}
.section-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  margin-top: 0;
  background: linear-gradient(to right, var(--cyan-400), var(--blue-400));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.section-subtitle {
  font-size: 1.25rem;
  color: var(--gray-300);
  max-width: 48rem;
  margin: 0 auto;
}

.grid-2-col {
  display: grid;
  gap: 3rem;
  align-items: center;
}

.tech-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  overflow: visible;
  padding: 1rem 0;
}

.card {
  padding: 2rem;
  background-color: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--slate-700);
  border-radius: 0.75rem;
  backdrop-filter: blur(4px);
  height: 100%;
}

.card-title-small {
  font-weight: 700;
  color: var(--white);
  margin-top: 0;
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.card-description {
  color: var(--gray-300);
  margin-bottom: 1rem;
  line-height: 1.6;
  flex: 1;
}

.portfolio-carousel-container {
  position: relative;
  overflow: hidden;
  margin: 2rem 0;
  padding: 1rem 0 2rem 0;
  cursor: grab;
  user-select: none;
  width: 100%;
  max-width: 100%;
  touch-action: pan-y;
  cursor: grab;
}

.portfolio-carousel {
  display: flex;
  gap: 2rem;
  will-change: transform;
}
.portfolio-carousel-container .portfolio-card * {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.portfolio-indicators {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
}

.indicator {
  border: none;
  padding: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--slate-600);
  cursor: pointer;
  transition: all 0.3s ease;
}

.indicator.active {
  background-color: var(--cyan-400);
  transform: scale(1.2);
}

.indicator:hover {
  background-color: var(--cyan-500);
  transform: scale(1.1);
}

.portfolio-card {
  flex: 0 0 auto;
  width: min(350px, calc(100vw - 4rem));
  margin-bottom: 1rem;
  backface-visibility: hidden;
  overflow: hidden;
  padding: 0;
  background-color: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--slate-700);
  border-radius: 0.75rem;
  backdrop-filter: blur(4px);
  height: 100%;
  transition: border-color 0.3s ease;
  display: flex;
  flex-direction: column;
}
.portfolio-card:hover {
  transform: translateY(-10px);
  border-color: var(--cyan-alpha-50);
}
.portfolio-card:hover .card-image {
  transform: scale(1.1);
}
.portfolio-card:hover .card-image-overlay,
.portfolio-card:hover .card-link-button {
  opacity: 1;
}
.card-image-container {
  position: relative;
  overflow: hidden;
}
.card-image {
  width: 100%;
  height: auto;
  /* height: 12rem; */
  aspect-ratio: 350 / 200;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.card-image-overlay,
.card-link-button {
  position: absolute;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card-image-overlay {
  inset: 0;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.8), transparent);
}

.card-link-button {
  bottom: 1rem;
  right: 1rem;
  background-color: var(--cyan-500);
  color: var(--white);
  padding: 0.5rem;
  border-radius: 0.5rem;
}
.card-link-button:hover {
  background-color: var(--hover-cyan);
}
.card-content {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
}
.tech-tag {
  padding: 0.25rem 0.75rem;
  background-color: var(--cyan-alpha-10);
  color: var(--cyan-400);
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--cyan-alpha-20);
}

.tech-item {
  position: relative;
  overflow: visible;
  opacity: 1;
}

.tech-item .card {
  background: linear-gradient(
    135deg,
    rgba(15, 23, 42, 0.95) 0%,
    rgba(30, 41, 59, 0.95) 100%
  );
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 1rem;
  padding: 1.25rem 1rem;
  backdrop-filter: blur(20px);
  position: relative;
  height: 100px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  will-change: transform, box-shadow, border-color;
}

.tech-item .card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(6, 182, 212, 0.8),
    transparent
  );
  opacity: 0;
  transition: opacity 0.4s ease;
}

.tech-item.hovered .card::before {
  opacity: 1;
}

.tech-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  display: block;
}

.tech-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--white);
  margin: 0;
  letter-spacing: 0.5px;
}

.contact-info-list {
  max-width: 600px;
  margin: 0 auto;
  overflow: hidden;
  opacity: 0;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  color: inherit;
  transition: background-color 0.3s ease, color 0.3s ease;
  border-radius: 0.5rem;
  padding: 1rem;
  margin: -1rem;
}

.contact-item:hover h4,
.contact-item:hover p {
  color: var(--cyan-500);
}
.contact-icon-wrapper {
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.contact-icon-wrapper.mail {
  background: linear-gradient(to right, var(--cyan-500), var(--blue-500));
}
.contact-icon-wrapper.github {
  background: linear-gradient(to right, #4b5563, #111827);
}

.contact-item h4 {
  color: var(--white);
  font-weight: 500;
  margin: 0 0 0.25rem 0;
}
.contact-item p {
  color: var(--gray-300);
  margin: 0;
}

/* Mobile Styles (320px - 767px) */
@media (max-width: 767px) {
  .container {
    padding: 0 1rem;
    max-width: none;
  }

  .navbar {
    padding: 1.5rem 1rem;
  }

  .nav-menu {
    position: fixed;
    top: 78.5px;
    right: -100%;
    width: 100%;
    height: calc(100vh - 78.5px);
    flex-direction: column;
    align-items: center;
    padding-top: 3rem;
    gap: 2.5rem;
    background-color: var(--slate-bg-dark);
    transition: right 0.3s ease-in-out;
  }

  .nav-menu.active {
    right: 0;
  }

  .nav-link {
    font-size: 1.25rem;
  }

  .nav-toggle {
    display: flex;
  }

  .hero-title {
    font-size: 2.6rem;
    line-height: 1.2;
    text-align: center;
    margin-top: 6rem;
  }

  .hero-buttons {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    margin-top: 8rem;
  }

  .btn-primary {
    margin-bottom: 0.5rem;
  }

  #about .container {
    grid-template-columns: 1fr;
  }

  .profile-card {
    max-width: 320px;
    margin: 0 auto;
    padding: 1.5rem;
  }

  .portfolio-card {
    width: 280px;
  }

  .portfolio-carousel {
    gap: 1.5rem;
  }

  .indicator {
    width: 8px;
    height: 8px;
  }

  .hero-doodo {
    display: none;
  }
}

/* Tablet Styles (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  .hero-title {
    font-size: 3.5rem;
  }

  .hero-buttons {
    flex-direction: row;
  }

  .section-title {
    font-size: 3rem;
  }

  .portfolio-card {
    max-width: 300px;
  }

  .grid-2-col {
    grid-template-columns: repeat(2, 1fr);
  }

  .tech-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.75rem;
  }
  .contact-info-list {
    flex-direction: row;
    justify-content: center;
    gap: 4rem;
  }
}

@media (min-width: 1024px) and (max-width: 1511px) {
  .hero-title {
    font-size: 4rem;
  }

  .section-title {
    font-size: 3rem;
  }

  .hero-buttons,
  .tech-grid {
    flex-direction: row;
  }

  .tech-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
  }

  .contact-info-list {
    flex-direction: row;
    justify-content: center;
  }

  .portfolio-card {
    max-width: 320px;
  }

  .contact-info-list {
    gap: 4rem;
  }
}

@media (min-width: 1512px) {
  .hero-title {
    font-size: 4rem;
  }

  .hero-buttons,
  .tech-grid {
    flex-direction: row;
  }

  .section-title {
    font-size: 3.5rem;
  }

  .tech-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
  }

  .contact-info-list {
    flex-direction: row;
    justify-content: center;
  }
  .contact-info-list {
    gap: 6rem;
  }
}

@media (max-height: 550px) and (orientation: landscape) {
  .hero-section {
    min-height: auto;
    padding-top: 7rem;
    padding-bottom: 4rem;
    align-items: flex-start;
  }

  .hero-title {
    margin-top: 0;
    margin-bottom: 3rem;
    font-size: 3rem;
  }

  .hero-doodo,
  .scroll-indicator {
    display: none;
  }

  .navbar {
    padding: 0.75rem 2rem;
  }

  @media (max-width: 767px) {
    .nav-menu {
      top: 54.5px;
      height: 100vh;
      gap: 1rem;
    }
  }
}
