:root {
  --primary-color: #0f4c81; /* 經典典雅藍 */
  --primary-hover: #0a365c;
  --primary-light: #e8f1f8;
  --accent-color: #0284c7;  /* 亮藍點綴 */
  --accent-gold: #f59e0b;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --bg-light: #f8fafc;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.03);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --transition: all 0.25s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color: var(--text-dark);
  background-color: var(--bg-light);
  line-height: 1.6;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 頂部導覽列 (Google Sites 風格) */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--primary-color);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
}

.nav-brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: contain;
  display: block;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(15, 76, 129, 0.15);
  transition: transform 0.25s ease;
}

.nav-brand:hover .nav-brand-logo {
  transform: scale(1.08) rotate(5deg);
}

.nav-menu {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 0.5rem;
}

.nav-item a {
  display: block;
  padding: 0.5rem 0.9rem;
  text-decoration: none;
  color: #475569;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-item a:hover {
  color: var(--primary-color);
  background-color: var(--primary-light);
}

.nav-item a.active {
  color: var(--primary-color);
  font-weight: 700;
  background-color: rgba(15, 76, 129, 0.08);
  border-bottom: 2px solid var(--primary-color);
  border-radius: 4px 4px 0 0;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text-dark);
}

/* 主頁橫幅 (Hero Banner) - 呈現照片原始自然色彩，不帶藍色遮罩 */
.hero-banner {
  position: relative;
  background-color: #334155;
  background-image: url('../images/banner_bg.jpg');
  background-size: cover;
  background-position: center 30%;
  background-repeat: no-repeat;
  color: #ffffff;
  padding: 4.5rem 1.5rem;
  text-align: center;
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.25);
}

.hero-banner::before {
  display: none;
}

.hero-content {
  position: relative;
  max-width: 960px;
  margin: 0 auto;
  background: rgba(15, 23, 42, 0.65); /* 柔和深色透明毛玻璃，保有照片原色穿透感 */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius-lg);
  padding: 3rem 2.25rem 2.5rem;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 0.4rem 1.25rem;
  border-radius: 9999px;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  letter-spacing: 0.5px;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.hero-title {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: 2px;
  margin-bottom: 1rem;
  line-height: 1.25;
  color: #ffffff;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.8), 0 1px 3px rgba(0, 0, 0, 0.9);
}

.hero-subtitle {
  font-size: 1.2rem;
  color: #f1f5f9;
  margin-bottom: 2rem;
  font-weight: 500;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.75);
}

.hero-meta-bar {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  background: rgba(0, 0, 0, 0.45);
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.92rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* 主容器排版 */
.main-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  width: 100%;
  flex: 1;
}

/* 區塊標準樣式 */
.section {
  margin-bottom: 4rem;
  scroll-margin-top: 80px;
}

.section-header {
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0.85rem;
}

.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-badge {
  background: var(--primary-color);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
}

.section-title {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--primary-color);
}

.section-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* 首頁四大快速通道卡片 */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.hub-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}

.hub-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-color);
}

.hub-icon {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  background: var(--primary-light);
  color: var(--primary-color);
  transition: var(--transition);
}

.hub-card:hover .hub-icon {
  background: var(--primary-color);
  color: white;
}

.hub-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

.hub-card:hover .hub-title {
  color: var(--primary-color);
}

.hub-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  flex: 1;
}

.hub-action {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-color);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* 簡介與特色區塊 */
.intro-panel {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2.5rem;
}

.intro-panel h3 {
  font-size: 1.25rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.goal-item {
  background: var(--bg-light);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--accent-color);
}

.goal-item strong {
  display: block;
  font-size: 1rem;
  color: var(--text-dark);
  margin-bottom: 0.25rem;
}

.goal-item p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* PDF 閱讀器容器 */
.pdf-viewer-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.pdf-toolbar {
  background: #f1f5f9;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.pdf-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--text-dark);
}

.pdf-actions {
  display: flex;
  gap: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-outline {
  background-color: white;
  color: #475569;
  border-color: #cbd5e1;
}

.btn-outline:hover {
  background-color: #f8fafc;
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.pdf-frame-wrapper {
  width: 100%;
  height: 680px;
  background: #525659;
  position: relative;
}

.pdf-frame {
  width: 100%;
  height: 100%;
  border: none;
}

/* 行動版專屬文件預覽卡片 (避免手機瀏覽器於iframe載入PDF時引發自動下載與搶占畫面) */
.mobile-doc-preview {
  display: none;
  padding: 1.5rem;
  background: #f8fafc;
  text-align: center;
}

.mobile-doc-thumb-wrap {
  position: relative;
  max-width: 460px;
  margin: 0 auto;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  background: white;
}

.mobile-doc-thumb {
  width: 100%;
  display: block;
  object-fit: cover;
}

.mobile-doc-overlay-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--primary-color);
  color: #ffffff;
  padding: 0.85rem 1.25rem;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  transition: var(--transition);
}

.mobile-doc-overlay-btn:hover {
  background: var(--primary-hover);
}

@media (max-width: 768px) {
  .desktop-only-viewer {
    display: none !important;
  }
  .mobile-doc-preview {
    display: block !important;
  }
}

/* 班級清單專屬：分類 Tab 與卡片 */
.grade-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.tab-btn {
  padding: 0.6rem 1.2rem;
  border-radius: 9999px;
  background: white;
  border: 1px solid var(--border-color);
  color: #64748b;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.tab-btn.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

.classes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.class-card {
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.class-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #93c5fd;
  transform: translateY(-2px);
}

.class-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.class-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-color);
}

.class-tag {
  background: var(--primary-light);
  color: var(--primary-color);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.class-filename {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  word-break: break-all;
}

.class-btn-group {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
}

.class-btn-group .btn {
  flex: 1;
  justify-content: center;
  font-size: 0.8rem;
  padding: 0.45rem 0.5rem;
}

/* 評分表標準向度卡片 */
.rubric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.rubric-card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.rubric-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.rubric-percent {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-color);
  background: var(--primary-light);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
}

.rubric-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
}

.rubric-list {
  list-style: none;
}

.rubric-list li {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: #475569;
}

.rubric-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent-color);
  font-weight: bold;
  font-size: 1.2rem;
  line-height: 1;
}

/* 相片牆 (Gallery) */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.photo-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: white;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
  aspect-ratio: 4 / 3;
}

.photo-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-color);
}

.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.photo-card:hover img {
  transform: scale(1.05);
}

.photo-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, transparent 100%);
  color: white;
  padding: 1.5rem 1rem 0.75rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  opacity: 0.9;
  transition: var(--transition);
}

.photo-title {
  font-size: 0.875rem;
  font-weight: 600;
}

.photo-zoom-icon {
  background: rgba(255, 255, 255, 0.2);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Lightbox 燈箱元件 */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 15, 25, 0.94);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  backdrop-filter: blur(8px);
}

.lightbox.active {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: var(--radius-sm);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  object-fit: contain;
}

.lightbox-caption {
  color: #e2e8f0;
  font-size: 1rem;
  margin-top: 0.75rem;
  text-align: center;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 25px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.08);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
  left: 25px;
}

.lightbox-next {
  right: 25px;
}

/* Modal 彈窗 (用於班級清單快速檢視) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-dialog {
  background: white;
  width: 90vw;
  max-width: 960px;
  height: 85vh;
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
}

.modal-header {
  padding: 1rem 1.5rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #64748b;
  line-height: 1;
}

.modal-body {
  flex: 1;
  background: #525659;
}

.modal-body iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* 頁尾 */
.footer {
  background-color: #0c1d2e;
  color: #94a3b8;
  padding: 3rem 1.5rem 2rem;
  border-top: 1px solid #1e293b;
  font-size: 0.9rem;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-brand h4 {
  color: #ffffff;
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
}

.footer-info p {
  margin-bottom: 0.4rem;
}

.footer-links h5 {
  color: #ffffff;
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.footer-links ul {
  list-style: none;
}

.footer-links li {
  margin-bottom: 0.4rem;
}

.footer-links a {
  color: #94a3b8;
  text-decoration: none;
  transition: var(--transition);
}

.footer-links a:hover {
  color: #38bdf8;
}

.footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 1.5rem;
  border-top: 1px solid #1e293b;
  text-align: center;
  font-size: 0.85rem;
  color: #64748b;
}

/* 回到頂部按鈕 */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  border: none;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 900;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--accent-color);
  transform: translateY(-3px);
}

/* 響應式調整 */
@media (max-width: 768px) {
  .nav-menu {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    border-bottom: 1px solid var(--border-color);
    display: none;
  }

  .nav-menu.active {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }

  .hero-content {
    padding: 2rem 1.25rem 1.75rem;
  }

  .hero-title {
    font-size: 1.85rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .pdf-frame-wrapper {
    height: 480px;
  }

  .lightbox-nav {
    width: 40px;
    height: 40px;
  }

  .lightbox-prev {
    left: 10px;
  }

  .lightbox-next {
    right: 10px;
  }
}
