/* 根元素和全域樣式 */
:root,
[data-theme="light"] {
  --background-color: #f0f0f0;
  --card-background: #ffffff;
  --info-box-bg: #ffffff;
  --text-color: #333;
  --text-color-light: #555;
  --body-bg: #e9e9e9;
  --dark-poster-bg: #f8f8f8;
  --dark-poster-text: #171717;
  --dark-poster-text-light: #555;
  --toggle-icon-color: #171717;
  --toggle-bg: rgba(0, 0, 0, 0.1);
  --toggle-border: rgba(0, 0, 0, 0.2);
  --social-icon-filter: none;
}

[data-theme="dark"] {
  --background-color: #212121;
  --card-background: #f8f8f8;
  --info-box-bg: #ffffff;
  --text-color: #333;
  --text-color-light: #555;
  --body-bg: #f0f0f0;
  --dark-poster-bg: #171717;
  --dark-poster-text: white;
  --dark-poster-text-light: #b0b0b0;
  --toggle-icon-color: white;
  --toggle-bg: rgba(33, 33, 33, 0.9);
  --toggle-border: rgba(255, 255, 255, 0.6);
  --social-icon-filter: none;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

html,
body {
  height: 100%;
  overflow: hidden;
  background-color: var(--body-bg);
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path fill="white" stroke="black" stroke-width="1.5" d="M16,2 L19.5,11.5 L29.5,12.5 L21.5,19 L24.5,29 L16,23.5 L7.5,29 L10.5,19 L2.5,12.5 L12.5,11.5 Z" /></svg>')
      16 16,
    auto;
  transition: background-color 0.5s ease;
}

@media (pointer: coarse) {
  body {
    cursor: default;
  }
}

/* #app 容器 */
#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--body-bg);
  transition: background-color 0.5s ease;
  position: relative;
}

/* loading 覆蓋層與 Spinner */
.loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.04) 100%
  );
  z-index: 120;
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
}

.loading-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  z-index: -1;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  position: relative;
  z-index: 1;
}

.loading-text {
  margin-top: 16px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 1px;
  opacity: 1;
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ============================================
   Header 和按鈕控制
   ============================================ */
.header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  position: absolute;
  top: 0;
  right: 0;
  z-index: 100;
}

/* 共用按鈕基礎樣式 */
#language-toggle,
#theme-toggle {
  position: relative;
  width: 40px;
  height: 40px;
  background-color: var(--toggle-bg);
  border: 1.5px solid var(--toggle-border);
  border-radius: 50%;
  cursor: pointer;
  outline: none;
  overflow: hidden;
  transition: background-color 0.3s ease, transform 0.2s ease,
    border-color 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset, 0 2px 8px rgba(255, 255, 255, 0.1);
}

/* 共用按鈕 hover 效果 */
#language-toggle:hover,
#theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset,
    0 4px 12px rgba(255, 255, 255, 0.15);
}

/* 深色主題共用按鈕樣式 */
[data-theme="dark"] #language-toggle,
[data-theme="dark"] #theme-toggle {
  background-color: rgba(33, 33, 33, 0.9);
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset,
    0 2px 12px rgba(255, 255, 255, 0.15), 0 0 0 2px rgba(0, 0, 0, 0.3);
}

/* 深色主題共用按鈕 hover 效果 */
[data-theme="dark"] #language-toggle:hover,
[data-theme="dark"] #theme-toggle:hover {
  background-color: rgba(33, 33, 33, 1);
  border-color: rgba(255, 255, 255, 0.8);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(255, 255, 255, 0.3) inset,
    0 4px 16px rgba(255, 255, 255, 0.2), 0 0 0 2px rgba(0, 0, 0, 0.4);
}

/* 語言選擇器容器 */
.language-selector {
  position: relative;
}

/* 地球圖標樣式 */
.globe-icon {
  width: 20px;
  height: 20px;
  color: var(--toggle-icon-color);
  display: block;
}

/* 語言下拉選單 */
.language-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background-color: var(--toggle-bg);
  border: 1.5px solid var(--toggle-border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset, 0 2px 8px rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  overflow: hidden;
  z-index: 1000;
  min-width: 120px;
  animation: dropdownFadeIn 0.2s ease-out;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

[data-theme="dark"] .language-dropdown {
  background-color: rgba(33, 33, 33, 0.95);
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset,
    0 2px 12px rgba(255, 255, 255, 0.15), 0 0 0 2px rgba(0, 0, 0, 0.3);
}

/* 語言選項按鈕 */
.language-option {
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: var(--toggle-icon-color);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.language-option:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.language-option.active {
  background-color: rgba(255, 255, 255, 0.15);
  font-weight: 600;
}

[data-theme="dark"] .language-option:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .language-option.active {
  background-color: rgba(255, 255, 255, 0.15);
}

/* 主題切換圖標樣式 */
.icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  color: var(--toggle-icon-color);
  display: block;
}

/* star-container 和 rotating-star */
.star-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, calc(-50% - 250px));
  z-index: 15;
  pointer-events: none;
}

.rotating-star {
  width: 80px;
  height: 80px;
  opacity: 0;
  scale: 0;
}

/* content-container 和 scroll-wrapper */
.content-container {
  flex: 1;
  display: flex;
  overflow-x: scroll;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background-color: var(--background-color);
  padding: 0;
  transition: background-color 0.5s ease;
}

.content-container::-webkit-scrollbar {
  display: none;
}

.scroll-wrapper {
  display: flex;
  min-width: fit-content;
  height: 100%;
  gap: 50px;
  align-items: center;
  padding: 0 40px;
}

/* column 卡片基本樣式 */
.column {
  position: relative;
  width: 350px;
  height: 500px;
  background-color: var(--card-background);
  padding: 20px;
  flex-shrink: 0;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  transition: box-shadow 0.3s ease, background-color 0.5s ease;
  border-right: none !important;
}

.column:hover {
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

/* poster-header 樣式 */
.poster-header {
  text-align: center;
  margin-bottom: 20px;
  height: 50px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex-shrink: 0;
}

.poster-header h1 {
  font-size: clamp(16px, 5vmin, 24px);
  font-family: "Noto Sans TC", sans-serif;
  letter-spacing: 1px;
  margin-bottom: 2px;
}

.poster-header p {
  font-size: clamp(16px, 5vmin, 18px);
  font-family: "Noto Sans TC", sans-serif;
}

/* image-wrapper 樣式 */
.image-wrapper {
  position: relative;
  width: 100%;
  height: 225px;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
  flex-shrink: 0;
}

.image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.column:hover .image-wrapper img {
  transform: translateY(-20%);
}

/* side-decoration 樣式 */
.side-decoration {
  position: absolute;
  top: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
}

.side-decoration span {
  font-size: clamp(12px, 5vmin, 14px);
  letter-spacing: 9px;
  text-orientation: mixed;
  writing-mode: vertical-rl;
  text-transform: uppercase;
}

.side-decoration .vertical-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  writing-mode: initial;
  text-orientation: initial;
  text-transform: none;
  gap: 2px;
}

.side-decoration .vertical-text .char {
  display: block;
  font-size: clamp(12px, 5vmin, 14px);
  text-align: center;
}

.side-decoration .stars {
  font-size: clamp(16px, 5vmin, 24px);
  line-height: 0.5;
  display: block;
  text-align: center;
}

.side-left {
  left: 0;
}

.side-right {
  right: 5px;
  text-align: right;
}

/* info-box 樣式 */
.info-box {
  background-color: var(--info-box-bg);
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  height: 225px;
  padding: 20px;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.info-box::-webkit-scrollbar {
  width: 6px;
}

.info-box::-webkit-scrollbar-track {
  background: transparent;
}

.info-box::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.info-box::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 0, 0, 0.3);
}

.info-box h3 {
  font-size: clamp(10px, 5vmin, 16px);
  font-family: "Noto Sans TC", sans-serif;
  margin-bottom: 5px;
}

.info-box p {
  font-size: clamp(10px, 5vmin, 14px);
  font-family: "Noto Sans TC", sans-serif;
  line-height: 1.5;
  margin-bottom: 15px;
}

.info-content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 10px;
}

.info-content-grid .date {
  font-size: clamp(10px, 5vmin, 16px);
  font-family: "Noto Sans TC", sans-serif;
  font-weight: bold;
}

.info-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: clamp(10px, 5vmin, 14px);
}

.social-icons {
  display: flex;
  gap: 5px;
}

/* 文字顏色樣式 */
.poster-header h1,
.side-decoration span,
.info-box h3,
.info-content-grid .date {
  color: var(--text-color);
}

.poster-header p,
.side-decoration .stars,
.info-box p,
.info-footer span {
  color: var(--text-color-light);
}

/* dark-poster 特殊樣式 */
.column.dark-poster {
  background-color: var(--dark-poster-bg);
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path fill="white" stroke="black" stroke-width="1.5" d="M16,2 L19.5,11.5 L29.5,12.5 L21.5,19 L24.5,29 L16,23.5 L7.5,29 L10.5,19 L2.5,12.5 L12.5,11.5 Z" /></svg>')
      16 16,
    auto;
  padding: 0;
  border-radius: 0;
}

.dark-poster .top-info,
.dark-poster .main-content,
.dark-poster .day-counter,
.dark-poster .title-block h1,
.dark-poster .bottom-info h3 {
  color: var(--dark-poster-text);
}

.dark-poster .vertical-text-dark,
.dark-poster .bottom-info p,
.dark-poster .title-block p {
  color: var(--dark-poster-text-light);
}

.dark-poster .top-info {
  position: absolute;
  top: 25px;
  left: 25px;
  right: 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  text-transform: uppercase;
  z-index: 2;
}

.dark-poster .top-info .info-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.dark-poster .main-content {
  position: relative;
  height: 100%;
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  z-index: 1;
}

.dark-poster .day-counter {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 8rem;
  font-weight: bold;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
  z-index: 3;
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  white-space: nowrap;
}

.dark-poster .apart-counter {
  margin-top: 12px;
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 2px;
  opacity: 0.75;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.dark-poster .title-block,
.dark-poster .bottom-info {
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

.dark-poster:hover .title-block,
.dark-poster:hover .bottom-info {
  opacity: 1;
}

.dark-poster .title-block {
  padding-top: 40px;
}

.dark-poster .title-block h1 {
  font-size: clamp(38px, 4vmin, 44px);
  line-height: 1;
  margin-bottom: 5px;
  font-family: "Shrikhand", serif;
  font-weight: 400;
  font-style: normal;
}

.dark-poster .vertical-text-dark {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: 0.8rem;
  letter-spacing: 2px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.8;
}

.dark-poster .vertical-text-left {
  left: 20px;
}

.dark-poster .vertical-text-right {
  right: 20px;
}

/* fullscreen-modal 樣式 */
.fullscreen-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 110;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.fullscreen-modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-image {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.modal-text {
  position: absolute;
  color: white;
  padding: 1rem;
  font-size: 1.2rem;
  font-weight: bold;
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.modal-date {
  top: 2rem;
  left: 2rem;
}

/* RWD */
@media (max-width: 768px) {
  .scroll-wrapper {
    padding: 0 calc(50vw - 175px);
  }
}
