/*
    ======================================
    Global Settings & Theme
    ======================================
*/
:root {
  --black: #1a1a1a;
  --dark-grey: #222;
  --light-grey: #ddd;
  --primary-color: #ff9900;
  --text-color: var(--light-grey);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Courier New', Courier, monospace;
}

body {
  background-color: var(--black);
  color: var(--text-color);
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--light-grey);
}

/*
    ======================================
    Layout Sections
    ======================================
*/
.section {
  padding: 80px 5%;
  max-width: 1000px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

h1 {
  font-size: 5em;
  margin-bottom: 0.5em;
  color: var(--light-grey);
}

h2 {
  font-size: 2.5em;
  margin-bottom: 1em;
  border-left: 7px solid var(--primary-color);
  padding-left: 10px;
  color: var(--light-grey);
}

h3 {
  color: var(--primary-color);
  margin-bottom: 0.5em;
}

/*
    ======================================
    Navigation Bar
    ======================================
*/
nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 20px 5%;
  background: rgba(26, 26, 26, 0.9);
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.nav-links {
  display: flex;
}

nav button {
  font-size: 18px;
  color: var(--text-color);
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
  position: relative;
  border: none;
  background: none;
  text-transform: uppercase;
  transition: color 0.4s;
  padding: 5px 0;
  margin-left: 50px;
}

nav button:hover {
  color: #fff;
}

nav button:after {
  content: "";
  pointer-events: none;
  bottom: 0px;
  left: 50%;
  position: absolute;
  width: 0%;
  height: 2px;
  background-color: var(--primary-color);
  transition: width 0.4s, left 0.4s;
}

nav button:hover:after {
  width: 100%;
  left: 0%;
}

/*
    ======================================
    Language switcher (top-left)
    From Uiverse.io by r7chardgh
    ======================================
*/
.lang-switcher {
  position: fixed;
  top: 18px;
  left: 5%;
  z-index: 1001;
}

.lang-switcher .switch {
  font-size: 17px;
  position: relative;
  display: inline-block;
  width: 5em;
  height: 2.5em;
  user-select: none;
}

.lang-switcher .switch .cb {
  opacity: 0;
  width: 0;
  height: 0;
}

.lang-switcher .toggle {
  position: absolute;
  cursor: pointer;
  width: 100%;
  height: 100%;
  background-color: #373737;
  border-radius: 0.1em;
  transition: 0.4s;
  text-transform: uppercase;
  font-weight: 700;
  overflow: hidden;
  box-shadow: -0.3em 0 0 0 #373737, -0.3em 0.3em 0 0 #373737,
    0.3em 0 0 0 #373737, 0.3em 0.3em 0 0 #373737, 0 0.3em 0 0 #373737;
}

.lang-switcher .toggle > .left {
  position: absolute;
  display: flex;
  width: 50%;
  height: 88%;
  background-color: #f3f3f3;
  color: #373737;
  left: 0;
  bottom: 0;
  align-items: center;
  justify-content: center;
  transform-origin: right;
  transform: rotateX(10deg);
  transform-style: preserve-3d;
  transition: all 150ms;
  font-size: 0.65em;
}

.lang-switcher .toggle > .left::before {
  position: absolute;
  content: "";
  width: 100%;
  height: 100%;
  background-color: rgb(206, 206, 206);
  transform-origin: center left;
  transform: rotateY(90deg);
}

.lang-switcher .toggle > .left::after {
  position: absolute;
  content: "";
  width: 100%;
  height: 100%;
  background-color: rgb(112, 112, 112);
  transform-origin: center bottom;
  transform: rotateX(90deg);
}

.lang-switcher .toggle > .right {
  position: absolute;
  display: flex;
  width: 50%;
  height: 88%;
  background-color: #f3f3f3;
  color: rgb(206, 206, 206);
  right: 1px;
  bottom: 0;
  align-items: center;
  justify-content: center;
  transform-origin: left;
  transform: rotateX(10deg) rotateY(-45deg);
  transform-style: preserve-3d;
  transition: all 150ms;
  font-size: 0.55em;
  text-transform: none;
}

.lang-switcher .toggle > .right::before {
  position: absolute;
  content: "";
  width: 100%;
  height: 100%;
  background-color: rgb(206, 206, 206);
  transform-origin: center right;
  transform: rotateY(-90deg);
}

.lang-switcher .toggle > .right::after {
  position: absolute;
  content: "";
  width: 100%;
  height: 100%;
  background-color: rgb(112, 112, 112);
  transform-origin: center bottom;
  transform: rotateX(90deg);
}

.lang-switcher .switch input:checked + .toggle > .left {
  transform: rotateX(10deg) rotateY(45deg);
  color: rgb(206, 206, 206);
}

.lang-switcher .switch input:checked + .toggle > .right {
  transform: rotateX(10deg) rotateY(0deg);
  color: #487bdb;
}

/*
    ======================================
    Burger Menu
    ======================================
*/
.burger {
  display: none;
  position: relative;
  width: 40px;
  height: 30px;
  background: transparent;
  cursor: pointer;
  margin-left: 50px;
}

.burger input {
  display: none;
}

.burger span {
  display: block;
  position: absolute;
  height: 4px;
  width: 100%;
  background: var(--light-grey);
  border-radius: 9px;
  left: 0;
  transition: .25s ease-in-out;
}

.burger span:nth-of-type(1) {
  top: 0px;
  transform-origin: left center;
}

.burger span:nth-of-type(2) {
  top: 50%;
  transform: translateY(-50%);
  transform-origin: left center;
}

.burger span:nth-of-type(3) {
  top: 100%;
  transform-origin: left center;
  transform: translateY(-100%);
}

.burger input:checked ~ span:nth-of-type(1) {
  transform: rotate(45deg);
  top: 0px;
  left: 5px;
}

.burger input:checked ~ span:nth-of-type(2) {
  width: 0%;
  opacity: 0;
}

.burger input:checked ~ span:nth-of-type(3) {
  transform: rotate(-45deg);
  top: 29px;
  left: 5px;
}

/*
    ======================================
    Hero Section
    ======================================
*/
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.profile-photo {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 30px;
  border: 5px solid var(--primary-color);
  box-shadow: 0 0 20px rgba(255, 153, 0, 0.5);
}

.subtitle {
  font-size: 1.5em;
  color: var(--text-color);
}

/*
    ======================================
    Experience Timeline
    ======================================
*/
.timeline {
  position: relative;
  padding-left: 30px;
  margin-left: 20px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 0;
  height: 100%;
  width: 3px;
  background: #4F4F4F;
}

.timeline-item {
  margin-bottom: 40px;
  padding: 20px;
  background: var(--dark-grey);
  border-left: 5px solid var(--primary-color);
  border-radius: 5px;
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -38px;
  top: 25px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--primary-color);
  border: 3px solid var(--black);
}

.period {
  color: var(--text-color);
  font-style: italic;
  margin-bottom: 10px;
}

/*
    ======================================
    Projects
    ======================================
*/
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}

.project-card {
  background: var(--dark-grey);
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  border-top: 3px solid var(--primary-color);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(255, 153, 0, 0.3);
}

.project-card h4 {
  font-size: 1.5em;
  margin-bottom: 10px;
  color: var(--light-grey);
}

/*
    ======================================
    Media
    ======================================
*/
.media-content {
  display: flex;
  gap: 40px;
  align-items: center;
  margin-top: 30px;
}

.media-info {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex-grow: 1;
}

.media-button-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.media-photo {
  width: 250px;
  height: 250px;
  object-fit: cover;
  border-radius: 8px;
  border: 3px solid var(--primary-color);
  box-shadow: 0 0 15px rgba(255, 153, 0, 0.4);
}

.media-info p {
  margin-bottom: 20px;
  font-size: 1.1em;
}

.media-button {
  display: inline-flex;
  align-items: center;
  background: var(--primary-color);
  color: var(--black);
  padding: 12px 25px;
  border-radius: 5px;
  font-weight: bold;
  text-transform: uppercase;
  transition: background 0.3s ease, color 0.3s ease, transform 0.2s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.media-button:hover {
  background: var(--light-grey);
  color: var(--black);
  transform: translateY(-2px);
}

.media-button .icon {
  margin-right: 10px;
  font-size: 1.2em;
}

/*
    ======================================
    Certifications
    ======================================
*/
.certification-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  margin-top: 30px;
}

.cert-item {
  background: var(--dark-grey);
  padding: 25px;
  border-radius: 8px;
  border-left: 3px solid var(--primary-color);
}

.cert-item h4 {
  color: var(--light-grey);
  font-size: 1.2em;
  margin-bottom: 5px;
}

.cert-item .issued-by {
  color: var(--primary-color);
  font-size: 0.9em;
  margin-bottom: 5px;
}

.cert-item .date {
  font-size: 0.8em;
  color: #999;
}

/*
    ======================================
    Contact
    ======================================
*/
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 30px;
  justify-content: center;
}

.contact-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--dark-grey);
  padding: 15px 30px;
  border-radius: 8px;
  font-size: 1.2em;
  font-weight: bold;
  min-width: 150px;
  border: 1px solid var(--primary-color);
  color: var(--light-grey);
  transition: background 0.3s ease, color 0.3s ease, transform 0.2s ease;
}

.contact-button:hover {
  background: var(--primary-color);
  color: var(--black);
  transform: translateY(-3px);
}

.contact-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  margin-right: 10px;
}

/*
    ======================================
    Footer
    ======================================
*/
footer {
  text-align: center;
  padding: 20px;
  border-top: 1px solid var(--dark-grey);
  color: var(--text-color);
  margin-top: 50px;
}

/*
    ======================================
    Loading (glitch)
    ======================================
*/
.loader {
  position: fixed;
  inset: 0;
  background-color: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.8s ease-out, visibility 0.8s ease-out;
}

.loader.hidden {
  opacity: 0;
  visibility: hidden;
}

/* From Uiverse.io by andrew-demchenk0 */
.glitch {
  position: relative;
  font-size: 25px;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
  letter-spacing: 5px;
  z-index: 1;
  animation: shift 1s ease-in-out infinite alternate;
}

.glitch:before,
.glitch:after {
  display: block;
  content: attr(data-glitch);
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0.8;
}

.glitch:before {
  animation: glitch 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
  color: #8b00ff;
  z-index: -1;
}

.glitch:after {
  animation: glitch 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) reverse both infinite;
  color: #00e571;
  z-index: -2;
}

@keyframes glitch {
  0% { transform: translate(0); }
  20% { transform: translate(-3px, 3px); }
  40% { transform: translate(-3px, -3px); }
  60% { transform: translate(3px, 3px); }
  80% { transform: translate(3px, -3px); }
  to  { transform: translate(0); }
}

@keyframes shift {
  0%,40%,44%,58%,61%,65%,69%,73%,100% { transform: skewX(0deg); }
  41% { transform: skewX(10deg); }
  42% { transform: skewX(-10deg); }
  59% { transform: skewX(40deg) skewY(10deg); }
  60% { transform: skewX(-40deg) skewY(-10deg); }
  63% { transform: skewX(10deg) skewY(-5deg); }
  70% { transform: skewX(-50deg) skewY(-20deg); }
  71% { transform: skewX(10deg) skewY(-10deg); }
}

/*
    ======================================
    背景動畫容器 (保持你的背景設定)
    ======================================
*/
.container {
  position: fixed;
  inset: 0;
  z-index: -2;
  opacity: 0.4;
  /* 在這裡放你的 background / animation */
}

/*
    ======================================
    幣的物理層（不影響 layout）
    ======================================
*/
.falling-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: -1; /* 背景上、內容下 */
}

.falling-coin {
  position: absolute;
  width: 160px;      /*幣的大小尺寸*/
  height: 160px;    /*幣的大小尺寸*/
  border-radius: 50%;
  object-fit: cover;
  will-change: transform;
}

.falling-coin.hit {
  animation: coin-hit 0.25s ease-out;
}

@keyframes coin-hit {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.05); }
  60%  { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/*
    ======================================
    右下角固定圓形圖片
    ======================================
*/
.floating-image {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 1001;
}

.floating-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary-color);
  box-shadow: 0 0 20px rgba(255, 153, 0, 0.6);
  transition: all 0.3s ease;
  cursor: pointer;
}

.floating-img:hover {
  transform: scale(1.1);
  box-shadow: 0 0 30px rgba(255, 153, 0, 0.8);
}

/*
    ======================================
    Image lightbox (多張圖片預覽)
    ======================================
*/
.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.image-lightbox[hidden] {
  display: none;
}

.image-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  cursor: pointer;
}

.image-lightbox__dialog {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: min(96vw, 980px);
}

.image-lightbox__stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: min(92vw, 900px);
}

.image-lightbox__img {
  display: block;
  max-width: 100%;
  max-height: 82vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  border: 3px solid var(--primary-color);
  box-shadow: 0 0 40px rgba(255, 153, 0, 0.4);
  object-fit: contain;
}

.image-lightbox__counter {
  margin-top: 12px;
  font-size: 0.95em;
  color: var(--light-grey);
  letter-spacing: 0.05em;
}

.image-lightbox__nav {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border: 2px solid var(--primary-color);
  border-radius: 50%;
  background: rgba(26, 26, 26, 0.92);
  color: var(--light-grey);
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 2px;
  transition: background 0.25s ease, color 0.25s ease, opacity 0.25s ease;
}

.image-lightbox__nav:hover:not(:disabled) {
  background: var(--primary-color);
  color: var(--black);
}

.image-lightbox__nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.image-lightbox__close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 40px;
  height: 40px;
  border: 2px solid var(--primary-color);
  border-radius: 50%;
  background: var(--black);
  color: var(--light-grey);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s ease, color 0.25s ease;
  z-index: 2;
}

.image-lightbox__close:hover {
  background: var(--primary-color);
  color: var(--black);
}

/*
    ======================================
    RWD
    ======================================
*/
@media (max-width: 768px) {
  .lang-switcher {
    top: 14px;
    left: 12px;
  }

  .lang-switcher .switch {
    font-size: 14px;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 65px;
    right: 0;
    width: 100%;
    background: var(--dark-grey);
    flex-direction: column;
    text-align: center;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.5);
  }

  nav button {
    margin: 0;
    padding: 15px 0;
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: normal;
  }

  .burger {
    display: block;
  }

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

  .media-content {
    flex-direction: column;
    text-align: center;
  }

  .media-photo {
    width: 180px;
    height: 180px;
  }

  .contact-links {
    justify-content: center;
  }

  .contact-button {
    min-width: 120px;
    font-size: 1.1em;
    padding: 10px 20px;
  }

  .contact-icon {
    width: 18px;
    height: 18px;
  }

  .floating-image {
    bottom: 20px;
    right: 20px;
  }

  .floating-img {
    width: 60px;
    height: 60px;
  }

  .image-lightbox__dialog {
    flex-direction: column;
    gap: 12px;
  }

  .image-lightbox__nav {
    width: 42px;
    height: 42px;
    font-size: 28px;
  }

  .image-lightbox__nav--prev,
  .image-lightbox__nav--next {
    order: 1;
  }

  .image-lightbox__stage {
    order: 0;
    width: 100%;
  }

  .image-lightbox__dialog > .image-lightbox__nav--prev,
  .image-lightbox__dialog > .image-lightbox__nav--next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
  }

  .image-lightbox__nav--prev {
    left: 8px;
  }

  .image-lightbox__nav--next {
    right: 8px;
  }

  .image-lightbox__img {
    max-height: 75vh;
  }
}

@media (max-width: 440px) {
  .media-button-wrapper {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  .media-button-wrapper .media-button {
    width: 100%;
    justify-content: center;
  }
}