/* ==========================================================================
   繪畫大公投 — 樣式
   數值對照原站 .vote-home / .pro-box / .modal 等規則，另補上無障礙與桌面呈現。
   ========================================================================== */

:root {
  /* 每一檔斷點會覆寫這幾個變數，桌機才不會只是一支被放大的手機 */
  --page-max: 100%;
  --cols: 2;
  --grid-gap: 12px;
  --box-pad: 12px;
  --banner-h: 160px;
  --footer-h: 100px;
  --shot-h: 130px;
  --head-h: 44px;
  --head-fs: 17px;
  --ink: #1f2937;
  --paper: #f0f2f5;
  --title-ink: #555;
  --brand-a: #ff4500;
  --brand-b: #ffa500;
  --head-a: #ff7a00;
  --head-b: #ff9500;
  --modal-bg: #fffbf0;
  --modal-line: #ffe8b1;
}

* { box-sizing: border-box; }

/*
 * 作者樣式的 display 會蓋掉瀏覽器預設的 [hidden]，
 * 所以 .vf-user / .vf-login 這類 display:flex 的元素加了 hidden 仍然會露出來。
 * 一律用這條兜底。
 */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC",
    "PingFang TC", "Microsoft JhengHei", sans-serif;
  color: var(--ink);
  background: #e9edf2;
  -webkit-font-smoothing: antialiased;
}

img { border: 0; }

/* 手機上滿版，桌機上跟著斷點放寬 */
.page {
  max-width: var(--page-max);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--paper);
  box-shadow: 0 0 40px rgba(15, 41, 77, 0.12);
}

/* --------------------------------------------------------------- 標題列 */
.vote-header {
  height: var(--head-h);
  line-height: var(--head-h);
  text-align: center;
  font-size: var(--head-fs);
  font-weight: 600;
  color: #fff;
  background: linear-gradient(90deg, var(--head-a), var(--head-b));
  letter-spacing: 0.5px;
}

.vote-body {
  background: linear-gradient(-180deg, #fff 80px, var(--paper) 130px);
  padding-bottom: 20px;
}

/* --------------------------------------------------------------- 輪播 */
.banner-wrap {
  position: relative;
  height: var(--banner-h);
  overflow: hidden;
}

.banner-track {
  display: flex;
  height: 100%;
  transition: transform 0.3s ease;
}

.banner-slide {
  flex: 0 0 100%;
  height: 100%;
}

.banner-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.banner-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  display: flex;
  justify-content: center;
  gap: 2px;
}

.banner-dot {
  width: 20px;
  height: 16px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.banner-dot::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ddd;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
  transition: background 0.2s ease, transform 0.2s ease;
}

.banner-dot.active::after {
  background: #3264ff;
  transform: scale(1.15);
}

/* --------------------------------------------------------------- 按鈕 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  font-family: inherit;
  border: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--brand-a), var(--brand-b));
  color: #fff;
  text-align: center;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.06s ease;
}

.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { cursor: not-allowed; filter: grayscale(0.75) brightness(1.02); opacity: 0.85; }

.btn-ghost {
  background: #fff;
  border: 1px solid #d9dee6;
  color: #4b5563;
}

.nav-box {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-top: 30px;
}

.nav-box .btn {
  width: 35%;
  max-width: 240px;
  height: 32px;
}

/* --------------------------------------------------------------- 區塊標題 */
.section-title-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 30px;
}

.section-title {
  width: 240px;
  height: 70px;
  line-height: 75px;
  padding-top: 13px;
  padding-right: 20px;
  color: #fff;
  text-align: center;
  font-weight: 600;
  letter-spacing: 1px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* --------------------------------------------------------------- 作品列表 */
.pro-box {
  padding: var(--box-pad);
  margin-top: 30px;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: var(--grid-gap);
  min-height: 300px;
  align-content: start;
}

.pro-item {
  background: #fff;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  padding: 10px;
  box-shadow: 0 2px 8px rgba(15, 41, 77, 0.2);
  min-width: 0;
}

.pro-image-btn,
.pro-vote-link {
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pro-image {
  width: 100%;
  height: var(--shot-h);
  object-fit: cover;
  display: block;
  border-radius: 4px;
  background: #f5f5f5;
}

.pro-title {
  font-weight: 600;
  color: var(--title-ink);
  margin-top: 10px;
  text-align: center;
}

.pro-vote-link {
  display: block;
  width: 100%;
}

.vote-btn {
  width: 100%;
  margin-top: 10px;
}

.pro-item.is-voted {
  box-shadow: 0 2px 8px rgba(15, 41, 77, 0.2), 0 0 0 2px rgba(255, 120, 30, 0.55);
}

.pro-item.is-voted .vote-btn {
  background: #f1f3f6;
  color: #8b93a1;
  filter: none;
}

.pro-count {
  display: inline-block;
  min-width: 2ch;
}

.pro-count.bump {
  animation: bump 0.42s ease;
}

@keyframes bump {
  0% { transform: scale(1); }
  35% { transform: scale(1.28); color: #ff5d3c; }
  100% { transform: scale(1); }
}

.footer-banner {
  width: 100%;
  height: var(--footer-h);
  margin-top: 20px;
  display: block;
  object-fit: cover;
}

/* --------------------------------------------------------------- 彈窗 */
.mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 16px;
}

.mask[hidden] { display: none; }

.modal {
  background: var(--modal-bg);
  border: 1px solid var(--modal-line);
  padding: 20px;
  border-radius: 8px;
  width: 100%;
  max-width: 375px;
  overflow: hidden;
  animation: pop 0.18s ease;
}

@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  gap: 12px;
}

.modal-title {
  font-weight: 600;
  font-size: 15px;
}

.modal-thumb {
  width: 56px;
  height: 45px;
  object-fit: contain;
  flex: 0 0 auto;
}

.modal-content {
  max-height: 300px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  line-height: 26px;
  font-size: 13px;
  color: #333;
}

.modal-intro {
  text-indent: 2rem;
  margin: 0 0 8px;
}

.modal-content h3 {
  margin: 10px 0 4px;
  font-size: 15px;
}

.modal-content p {
  margin: 0 0 6px;
}

.modal-close-btn {
  width: 100%;
  height: 40px;
  margin-top: 20px;
  font-size: 14px;
}

.image-modal {
  max-width: 420px;
}

.preview-image {
  width: 100%;
  display: block;
  border-radius: 4px;
  max-height: 62vh;
  object-fit: contain;
  background: #fff;
}

/* 投票確認 */
.vote-modal .modal-title {
  margin-bottom: 12px;
}

.vote-thumb {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 4px;
  background: #fff;
  display: block;
}

.vote-hint {
  font-size: 13px;
  line-height: 22px;
  color: #444;
  margin: 12px 0 0;
  text-align: center;
}

.vote-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.vote-actions .btn {
  flex: 1;
  height: 40px;
  font-size: 14px;
}

/* --------------------------------------------------------------- 提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translate(-50%, 20px);
  max-width: min(88vw, 380px);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(24, 31, 43, 0.92);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 1100;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* --------------------------------------------------------------- 斷點 */
/* 平板上 3 欄、筆電 4 欄、大螢幕 5 欄；橫幅與作品圖跟著放大 */

@media (min-width: 560px) {
  :root {
    --page-max: 760px;
    --cols: 3;
    --grid-gap: 16px;
    --box-pad: 20px;
    --banner-h: 210px;
    --footer-h: 130px;
    --shot-h: 150px;
    --head-h: 48px;
    --head-fs: 18px;
  }
  .page { box-shadow: 0 0 60px rgba(15, 41, 77, 0.1); }
  /* 橫幅按原圖比例走，才不會在寬螢幕上被裁掉上下緣 */
  .banner-wrap { height: auto; aspect-ratio: 1280 / 433; max-height: 260px; }
  .footer-banner { height: auto; aspect-ratio: 1923 / 493; max-height: 200px; }
  .modal { max-width: 420px; }
  .modal-content { max-height: 55vh; }
  .image-modal { max-width: 520px; }
  .preview-image { max-height: 68vh; }
}

@media (min-width: 900px) {
  :root {
    --page-max: 1080px;
    --cols: 4;
    --grid-gap: 20px;
    --box-pad: 24px;
    --banner-h: 280px;
    --footer-h: 170px;
    --shot-h: 170px;
    --head-h: 54px;
    --head-fs: 20px;
  }
  .nav-box .btn { height: 36px; font-size: 14px; }
  .banner-wrap { max-height: 380px; }
  .footer-banner { max-height: 260px; }
  .pro-title { font-size: 15px; }
  .vote-btn { height: 36px; font-size: 14px; }
  .image-modal { max-width: 620px; }
}

@media (min-width: 1280px) {
  :root {
    --page-max: 1240px;
    --cols: 5;
    --banner-h: 320px;
    --footer-h: 200px;
    --shot-h: 190px;
  }
}

/* 滑鼠裝置才給卡片浮起效果 */
@media (hover: hover) and (min-width: 900px) {
  .pro-item {
    transition: transform 0.18s ease, box-shadow 0.18s ease;
  }
  .pro-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 22px rgba(15, 41, 77, 0.22);
  }
}

/* --------------------------------------------------------------- 小螢幕 */
@media (max-width: 360px) {
  .section-title { width: 220px; }
  :root { --shot-h: 118px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
