:root {
  --text: #3E2A1D;
  --links: #627BC2;
  --border: #574133;
  --white: #F2F2F2;
  --wooden-stick: #E58F68;
  --shadow: rgba(0, 0, 0, 0.5);
  --text-alt: #616161;
  --dango-blue: #7BCCE7;
  --dango-blue-alt: #5BB1D3;
  --dango-red: #FFC6BD;
  --dango-red-alt: #ED8380;
  --dango-yellow: #FAD6A2;
  --dango-yellow-alt: #F4B678;
  --font: "GenSen Rounded TW", "Zen Maru Gothic", "Noto Sans TC", system-ui, -apple-system, "Segoe UI", sans-serif;
}

html {
  background-color: var(--dango-red);
}

@font-face {
  font-family: "GenSen Rounded TW";
  src: url("/fonts/GenSenRounded2TW-R.subset.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "GenSen Rounded TW";
  src: url("/fonts/GenSenRounded2TW-B.subset.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
  font-family: var(--font);
  font-style: normal;
}

body {
  margin: 0;
  min-height: 100vh;
  line-height: 1.6;
  background-image:
    radial-gradient(circle, var(--white) 1px, transparent 1px),
    radial-gradient(circle, var(--white) 1px, transparent 1px),
    linear-gradient(90deg, var(--dango-blue) 0% 33%, var(--dango-red) 33% 67%, var(--dango-yellow) 67% 100%);
  background-position: 0 0, 15px 15px, 0 0;
  background-size: 30px 30px, 30px 30px, 100% 100%;
  background-repeat: repeat, repeat, no-repeat;
  background-attachment: fixed;
}

.language-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10;
}

.language-toggle-label {
  display: inline-flex;
  cursor: pointer;
}

#language-checkbox {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.language-toggle-icon {
  display: block;
  width: 2rem;
  height: 2rem;
  filter: brightness(0) invert(1) drop-shadow(0 0 1px var(--border));
  transform-origin: center;
  rotate: 0deg;
  transition: rotate 600ms ease-in-out;
}

.language-toggle-icon.no-transition {
  transition: none;
}

#language-checkbox:checked + .language-toggle-icon {
  rotate: 360deg;
}

.container {
  max-width: 1200px;
  margin: auto;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

.container > img[src*="logo"] {
  display: block;
  margin-inline: auto;
  max-width: min(100%, clamp(250px, 20vw, 800px));
  height: auto;
}

.red-themed {
  --themed-card-border: var(--dango-red-alt);
  --themed-title-bg: var(--dango-red);
  --themed-social-icon: var(--dango-red-alt);
  --themed-card-bg: var(--dango-red-alt);
  --themed-member-bg: var(--dango-red);
  --themed-close-button-bg: var(--dango-red-alt);
}

.blue-themed {
  --themed-card-border: var(--dango-blue-alt);
  --themed-title-bg: var(--dango-blue);
  --themed-social-icon: var(--dango-blue-alt);
  --themed-card-bg: var(--dango-blue-alt);
  --themed-member-bg: var(--dango-blue);
  --themed-close-button-bg: var(--dango-blue-alt);
}

.yellow-themed {
  --themed-card-border: var(--dango-yellow-alt);
  --themed-title-bg: var(--dango-yellow);
  --themed-social-icon: var(--dango-yellow-alt);
  --themed-card-bg: var(--dango-yellow-alt);
  --themed-member-bg: var(--dango-yellow);
  --themed-close-button-bg: var(--dango-yellow-alt);
}

.social-intro-group {
  --social-icon-size: clamp(1.5rem, 8vw, 2.5rem);
  --social-bar-width: clamp(1rem, 6vw, 4rem);
  --social-gap: clamp(0.2rem, 2vw, 0.6rem);
  --social-row-width: calc(
    7 * var(--social-icon-size) +
    2 * var(--social-bar-width) +
    8 * var(--social-gap)
  );
  width: min(var(--social-row-width), 100%);
  margin: 0 auto 4rem;
}

.social-icons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--social-gap);
  width: 100%;
  margin: 2rem 0 1.5rem;
  flex-wrap: nowrap;
}

.social-icons::before,
.social-icons::after {
  content: "";
  flex-shrink: 1;
  width: var(--social-bar-width);
  height: clamp(0.4rem, 2vw, 0.6rem);
  background-color: var(--wooden-stick);
  border-radius: 2rem;
}

.social-icons a {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 1;
  width: var(--social-icon-size);
  aspect-ratio: 1 / 1;
  background-color: var(--white);
  border-radius: 50%;
  font-size: clamp(0.7rem, 4vw, 1.2rem);
  text-decoration: none;
  transition: transform 0.3s, color 0.3s;
  color: var(--themed-social-icon);
  border: 1px solid var(--border);
  animation: social-icon-wave 3s ease-in-out infinite;
}

.social-icons a:nth-of-type(2) {
  animation-delay: 0.25s;
}

.social-icons a:nth-of-type(3) {
  animation-delay: 0.5s;
}

.social-icons a:nth-of-type(4) {
  animation-delay: 0.75s;
}

.social-icons a:nth-of-type(5) {
  animation-delay: 1s;
}

.social-icons a:nth-of-type(6) {
  animation-delay: 1.25s;
}

.social-icons a:nth-of-type(7) {
  animation-delay: 1.5s;
}

@keyframes social-icon-wave {
  0%, 16.6667%, 100% {
    translate: 0 0;
  }
  8.3333% {
    translate: 0 -0.35rem;
  }
}

.social-icons a:hover {
  transform: scale(1.2);
}

.intro-section {
  width: 100%;
  margin-top: 2.5rem;
  padding: 1rem clamp(1rem, 3vw, 2rem);
  border: 4px solid transparent;
  border-radius: 1rem;
  background:
    linear-gradient(var(--white), var(--white)) padding-box,
    linear-gradient(90deg,
      var(--dango-blue-alt) 0 33%,
      var(--dango-red-alt) 33% 67%,
      var(--dango-yellow-alt) 67% 100%) border-box;
  color: var(--text);
  text-align: center;
  font-size: 0.8rem;
}

.intro-section p {
  margin: 0;
}

.intro-hashtag {
  color: var(--links);
}

.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4rem;
}

.cards-grid .card {
  max-width: none;
  margin: 0;
}

@media (min-width: 768px) {
  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.card {
  position: relative;
  max-width: 900px;
  margin: 2rem auto 4rem;
  box-shadow: 10px 10px 10px var(--shadow);
}

.card-title {
  position: absolute;
  top: -1.5rem;
  left: -1rem;
  z-index: 2;
  background-color: var(--themed-title-bg);
  color: var(--text);
  padding: 0.4rem 0.5rem;
  /* font-weight: 700; */
  color: var(--text);
  border-radius: 10rem;
  border: 1px solid var(--border);
  box-shadow:
    0 0 0 4px var(--white),
    5px 5px 10px var(--shadow);
}

.card-wrapper {
  position: relative;
  aspect-ratio: 4 / 3;
  width: 100%;
  background-color: var(--themed-card-bg);
  border-radius: 0.5rem;
  border: 8px solid var(--themed-card-border);
  overflow: hidden;
  box-shadow:
    0 0 0 1px var(--border),
    0 0 0 10px var(--white);
}

.member-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
}

.card-wrapper iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  border-radius: 0.5rem;
}

.member {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  gap: 0.5rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.member::before {
  content: "";
  width: 1.5rem;
  height: 1rem;
  background-color: var(--white);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 80'%3E%3Cpath d='M15,15 L105,15 L60,70 Z' fill='white' stroke='white' stroke-width='10' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 80'%3E%3Cpath d='M15,15 L105,15 L60,70 Z' fill='white' stroke='white' stroke-width='10' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  animation: member-bounce 1.2s ease-in-out infinite;
  margin-bottom: 0.5rem;
}

@keyframes member-bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(0.4rem);
  }
}

.member img {
  width: min(100%, clamp(4rem, 23vw, 10rem));
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 2px solid var(--white);
  background-color: var(--themed-member-bg);
}

.member > span {
  width: 4rem;
  max-width: 100%;
  margin: 0.5rem auto 0;
  background-color: var(--themed-member-bg);
  color: var(--text);
  padding: 0.2rem 0.6rem;
  border-radius: 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: normal;
  text-align: center;
  border: 1px solid var(--border);
  box-shadow: 0 0 0 2px var(--white);
  animation: button-bounce 1.2s ease-in-out infinite;
}

.member-description {
  max-width: 100%;
  color: var(--white);
  font-size: 0.75rem;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
}

html.member-lightbox-open {
  overflow: hidden;
  scrollbar-gutter: stable;
}

.member-lightbox {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: clip;
  border: 0;
  background: transparent;
  color: var(--text);
  touch-action: pan-y pinch-zoom;
}

.member-lightbox.is-dragging {
  cursor: grabbing;
  user-select: none;
}

.member-lightbox::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.member-lightbox-window {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(90vw, 40rem);
  max-width: calc(100vw - 2rem);
  max-height: 90dvh;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y pinch-zoom;
  transform: translate(-50%, -50%);
  will-change: transform, opacity, filter;
  padding: 1.5rem 0 1.5rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--themed-member-bg);
  box-shadow: 0 0 0 8px var(--white);
}

.member-lightbox-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--themed-close-button-bg);
  color: var(--text);
  cursor: pointer;
}

.member-lightbox-close svg {
  display: block;
  width: 1rem;
  height: 1rem;
}

.member-lightbox-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: start;
  gap: 1rem;
}

.member-lightbox-info {
  min-width: 0;
}

.member-lightbox-info section + section {
  margin-top: 1rem;
}

.member-lightbox-info h3 {
  margin: 0 0 0.25rem;
}

.member-lightbox-info p {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.member-lightbox-info p[data-i18n$="_title"] {
  color: var(--text-alt);
}

.member-lightbox-social-icons {
  --social-icon-size: 2rem;
  --social-bar-width: clamp(1rem, 6vw, 4rem);
  --social-gap: 0.5rem;
  justify-content: center;
  gap: var(--social-gap);
  width: 100%;
  margin: 1.5rem 0 0;
}

.member-lightbox-small-image {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 1.5rem;
}

.member-lightbox-image {
  margin-top: 2rem;
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 65dvh;
  justify-self: center;
  object-fit: contain;
}

.loop-gallery {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 0.5rem;
}

.loop-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transform: translateX(0);
  z-index: 1;
}

.loop-image.is-active {
  opacity: 1;
}

.loop-image.slide-in-next,
.loop-image.slide-in-prev,
.loop-image.slide-out-next,
.loop-image.slide-out-prev {
  animation-duration: 400ms;
  animation-timing-function: ease;
}

.loop-image.slide-in-next {
  --slide-from: 12%;
  animation-name: loop-slide-in;
}

.loop-image.slide-in-prev {
  --slide-from: -12%;
  animation-name: loop-slide-in;
}

.loop-image.slide-out-next {
  --slide-to: -12%;
  animation-name: loop-slide-out;
}

.loop-image.slide-out-prev {
  --slide-to: 12%;
  animation-name: loop-slide-out;
}

@keyframes loop-slide-in {
  from {
    opacity: 0;
    transform: translateX(var(--slide-from, 0));
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes loop-slide-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(var(--slide-to, 0));
  }
}

.loop-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.6);
  color: var(--white);
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
  z-index: 2;
}

.loop-arrow:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: translateY(-50%) scale(1.05);
}

.loop-arrow-left {
  left: 0.5rem;
}

.loop-arrow-right {
  right: 0.5rem;
}

.loop-dots {
  position: absolute;
  bottom: 0.5rem;
  left: 0;
  right: 0;
  width: fit-content;
  max-width: calc(100% - 1rem);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  z-index: 2;
  border-radius: 1rem;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.8);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.loop-dots.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.loop-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.loop-dot:hover {
  background: rgba(255, 255, 255, 0.7);
  transform: scale(1.2);
}

.loop-dot.is-active {
  background: var(--white);
}

.loop-desc {
  position: absolute;
  top: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--white);
  font-size: 0.85rem;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 1rem);
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.loop-desc.is-visible {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .loop-image.slide-in-next,
  .loop-image.slide-in-prev,
  .loop-image.slide-out-next,
  .loop-image.slide-out-prev {
    animation: none;
  }

  .loop-arrow:hover {
    transform: translateY(-50%);
  }

  .loop-arrow,
  .loop-dot,
  .loop-dots,
  .loop-desc {
    transition: none;
  }

  .social-icons a {
    animation: none;
  }
}

.contact-form {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(0.25rem, 1vw, 0.5rem);
  padding: clamp(0.5rem, 1.5vw, 0.85rem);
  color: var(--text);
}

.contact-subject {
  margin-top: 0.5rem;
}

.contact-field label {
  display: block;
  margin-bottom: 0.15rem;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 0.5rem;
}

.contact-field input,
.contact-field textarea {
  display: block;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.25rem 0.45rem;
  background-color: var(--white);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.5;
}

.contact-field :is(input, textarea)::placeholder {
  color: var(--text-alt);
  opacity: 0.7;
}

.contact-field input {
  height: 2.2rem;
  line-height: 1.5;
}

.contact-message-field {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.contact-field textarea {
  flex: 1;
  min-height: 2rem;
  resize: none;
}

.contact-send {
  margin: 0.5rem;
  align-self: center;
  border-radius: 1rem;
  padding: 0.25rem 1rem;
  background-color: var(--dango-red);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border);
  box-shadow: 0 0 0 2px var(--white);
}

.contact-form :is(input, textarea, button):focus-visible {
  outline: 2px solid var(--border);
  outline-offset: 2px;
}

.contact-note {
  margin: 0;
  font-size: clamp(0.55rem, 1vw, 0.75rem);
  line-height: 1.15;
  text-align: center;
}

@keyframes button-bounce {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.back-to-top-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  margin: 3rem auto 0;
  padding: 0.25rem 0.75rem;
  border: 0;
  background: transparent;
  color: var(--white);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.back-to-top-button svg {
  display: block;
  width: 3rem;
  height: 1.5rem;
  overflow: visible;
}

.back-to-top-button:hover {
  transform: translateY(-0.2rem);
}

footer {
  color: var(--text-alt);
  text-align: center;
  margin-top: 3rem;
  font-size: 0.8rem;
}

footer a {
  color: var(--links);
  text-decoration: underline;
  font-weight: 700;
}

footer a:hover {
  color: var(--text);
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  .language-toggle-icon {
    transition-duration: 1ms;
  }

  .back-to-top-button {
    transition: none;
  }

  .back-to-top-button:hover {
    transform: none;
  }
}
