/* =============================================================================
   THA frontend — warm NGO palette (burgundy / sage / cream). Phase 3 + UI color (red restrained).
   Breakpoints: 375 / 768 / 1440 — no horizontal overflow.
   ============================================================================= */

:root {
  /* 新調色盤 — 暖白 / 鼠尾草 / 酒紅 */
  --color-primary: #9B2C2C;
  --color-primary-dark: #7E2323;
  --color-primary-light: #F8EAEA;
  --color-secondary: #7D9D83;
  --color-secondary-dark: #526E58;
  --color-secondary-light: #E6F0E8;
  --color-bg: #FAF8F4;
  --color-surface: #FFFFFF;
  --color-surface-warm: #FFFDFC;
  --color-footer: #F1EEE8;
  --color-text: #403B37;
  --color-text-secondary: #726B65;
  --color-text-muted: #8A837C;
  --color-border: #E7E1DA;
  --color-border-dark: #D8D1C9;
  --color-hover-bg: #FAF6F1;
  --shadow-card: 0 2px 8px rgba(70,60,50,.05);
  --shadow-card-hover: 0 8px 20px rgba(70,60,50,.10);

  /* 舊 --tha-* 對應新色票，既有規則繼續有效 */
  --tha-red: var(--color-primary);
  --tha-red-dark: var(--color-primary-dark);
  --tha-red-soft: var(--color-primary-light);
  --tha-bg: var(--color-bg);
  --tha-surface: var(--color-surface);
  --tha-text: var(--color-text);
  --tha-muted: var(--color-text-secondary);
  --tha-border: var(--color-border);
  --tha-ok: #1b5e20;
  --tha-fail: var(--color-primary);
  --tha-focus: var(--color-primary);
  --tha-max: 72rem; /* ~1152px; comfortable under 1440 */
  --tha-header-h: 4.5rem;
  --tha-radius: 4px;
  --tha-shadow: var(--shadow-card);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", sans-serif;
  color: var(--tha-text);
  background: var(--tha-bg);
  line-height: 1.6;
  overflow-x: hidden;
  min-width: 0;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-text-secondary);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--color-primary);
}

a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.nav-link:focus-visible,
.nav-toggle:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
.photo-gallery-link:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -100px;
  z-index: 1000;
  background: var(--tha-red-dark);
  color: #fff;
  padding: 0.5rem 1rem;
  text-decoration: none;
  border-radius: var(--tha-radius);
}

.skip-link:focus {
  top: 0.75rem;
}

.container {
  width: 100%;
  max-width: var(--tha-max);
  margin: 0 auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.container.narrow {
  /* Form / short-article pages only */
  max-width: 40rem;
}

/* About / scholarship / journal — match site width on desktop */
.container.page-content {
  max-width: var(--tha-max);
}

/* ----- Header / nav ----- */

.site-header {
  background: var(--color-surface-warm);
  border-bottom: 1px solid var(--color-border-dark);
  box-shadow: 0 2px 0 rgba(155, 44, 44, 0.18);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  min-height: var(--tha-header-h);
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--color-text);
  min-width: 0;
  flex: 1 1 auto;
}

.brand img {
  width: 56px;
  height: auto;
  flex-shrink: 0;
  object-fit: contain;
}

.brand-name {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  word-break: break-word;
}

.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0.5rem;
  border: 1px solid var(--tha-border);
  border-radius: var(--tha-radius);
  background: var(--tha-surface);
  cursor: pointer;
  flex-shrink: 0;
}

.nav-toggle-bar {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--color-text);
  border-radius: 1px;
}

.main-nav {
  width: 100%;
  display: none;
}

.main-nav.is-open {
  display: block;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.nav-link {
  display: block;
  padding: 0.65rem 0.75rem;
  text-decoration: none;
  color: var(--color-text);
  font-weight: 600;
  border-radius: var(--tha-radius);
  transition: color 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

.nav-link:hover,
.nav-link.is-active {
  background: var(--color-hover-bg);
  color: var(--color-primary);
}

.nav-link.is-active {
  box-shadow: inset 3px 0 0 var(--color-primary);
}

.nav-item {
  position: relative;
}

.nav-item-row {
  display: flex;
  align-items: stretch;
  gap: 0.15rem;
}

.nav-item-row .nav-link {
  flex: 1 1 auto;
}

.nav-submenu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  flex-shrink: 0;
  border: 1px solid var(--tha-border);
  border-radius: var(--tha-radius);
  background: var(--tha-surface);
  color: var(--tha-red-dark);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
}

.nav-submenu-toggle[aria-expanded="true"] {
  background: var(--tha-red-soft);
}

.nav-submenu {
  list-style: none;
  margin: 0;
  padding: 0 0 0.35rem 0.75rem;
  display: none;
}

.nav-item.is-open > .nav-submenu {
  display: block;
}

.nav-sublink {
  display: block;
  padding: 0.5rem 0.75rem;
  text-decoration: none;
  color: var(--tha-text);
  font-weight: 500;
  font-size: 0.95rem;
  border-radius: var(--tha-radius);
}

.nav-sublink:hover,
.nav-sublink.is-active {
  background: var(--tha-red-soft);
  color: var(--tha-red-dark);
}

body.nav-open {
  overflow: hidden;
}

/* ----- Main ----- */

.site-main {
  min-height: 50vh;
  padding-bottom: 2.5rem;
}

.section {
  padding: 2rem 0 0.5rem;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  border-bottom: 1px solid #D8C1BC;
  padding-bottom: 0.35rem;
}

.section-head h2 {
  margin: 0;
  font-size: 1.35rem;
  color: var(--color-text);
}

.section-more {
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  color: var(--color-secondary-dark);
  transition: color 0.25s ease;
}

.section-more:hover {
  color: var(--color-primary);
}

.empty-state {
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: 8px;
  padding: 1.25rem 1rem;
  color: var(--color-text-secondary);
  margin: 0;
}

/* ----- Buttons ----- */

.btn {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border-radius: var(--tha-radius);
  font-weight: 600;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  line-height: 1.4;
  text-align: center;
}

.btn-primary {
  background: var(--tha-red);
  color: #fff;
  border-color: var(--tha-red);
}

.btn-primary:hover {
  background: var(--tha-red-dark);
  border-color: var(--tha-red-dark);
  color: #fff;
}

.btn-secondary {
  background: var(--tha-red-dark);
  color: #fff;
  border-color: var(--tha-red-dark);
}

.btn-secondary:hover {
  background: var(--tha-red);
  border-color: var(--tha-red);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--tha-red-dark);
  border-color: var(--tha-red);
}

.btn-outline:hover {
  background: var(--tha-red-soft);
  color: var(--tha-red-dark);
}

/* ----- Hero ----- */

.hero {
  background: linear-gradient(180deg, #fff 0%, var(--tha-bg) 100%);
  border-bottom: 1px solid var(--tha-border);
  padding: 2rem 0 2.25rem;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.25rem;
}

.hero-logo {
  width: 120px;
  height: auto;
  margin: 0 auto;
}

.hero-title {
  margin: 0 0 0.5rem;
  color: var(--color-text);
  font-size: 1.55rem;
  line-height: 1.35;
  word-break: break-word;
}

.hero-slogan {
  margin: 0 0 1.25rem;
  color: var(--tha-muted);
  font-size: 1.05rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
}

/* ----- Hero carousel ----- */

.hero-carousel-wrap {
  padding: 0;
  border-bottom: 1px solid var(--tha-border);
  background: #1a1a1a;
  overflow: hidden;
}

.hero-carousel {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  overflow: hidden;
}

.hero-carousel-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 1;
  min-height: 180px;
  max-height: 480px;
  overflow: hidden;
  background: #111;
}

.hero-carousel-track {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  position: relative;
}

.hero-carousel-slide {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.55s ease;
  z-index: 0;
}

.hero-carousel-slide.is-active {
  opacity: 1;
  visibility: visible;
  z-index: 1;
}

.hero-carousel-link {
  display: block;
  width: 100%;
  height: 100%;
}

.hero-carousel-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.hero-carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: rgba(155, 44, 44, 0.88);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background-color 0.25s ease;
}

.hero-carousel-btn:hover,
.hero-carousel-btn:focus-visible {
  background: #7E2323;
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.hero-carousel-prev { left: 0.65rem; }
.hero-carousel-next { right: 0.65rem; }

.hero-carousel-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.75rem;
  z-index: 3;
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  padding: 0 0.5rem;
}

.hero-carousel-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.75);
  padding: 0;
  cursor: pointer;
}

.hero-carousel-dot.is-active,
.hero-carousel-dot[aria-selected="true"] {
  background: #9B2C2C;
  border-color: #fff;
}

.hero-carousel-dot:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.hero-carousel-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  pointer-events: none;
  /* 極淡漸層，僅提升文字可讀性 */
  background: linear-gradient(180deg, transparent 0%, rgba(64, 59, 55, 0.28) 100%);
  padding: 2.5rem 1rem 1.1rem;
  text-align: center;
}

.hero-carousel-brand {
  margin: 0;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  letter-spacing: 0.02em;
}

@media (min-width: 768px) {
  .hero-carousel-viewport {
    min-height: 260px;
  }
  .hero-carousel-brand {
    font-size: 1.15rem;
  }
  .hero-carousel-btn {
    width: 2.85rem;
    height: 2.85rem;
  }
}

@media (min-width: 1440px) {
  .hero-carousel-viewport {
    max-height: 520px;
  }
}

@media (max-width: 374px) {
  .hero-carousel-btn {
    width: 2.1rem;
    height: 2.1rem;
    font-size: 1.25rem;
  }
  .hero-carousel-prev { left: 0.35rem; }
  .hero-carousel-next { right: 0.35rem; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-carousel-slide {
    transition: none;
  }
}

.lead {
  color: var(--color-text-secondary);
  font-weight: 600;
}

/* ----- News list ----- */

.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
}

.news-item {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--color-border);
  transition: background-color 0.2s ease;
}

.news-item:last-child {
  border-bottom: none;
}

.news-item:hover {
  background: var(--color-hover-bg);
}

.news-item.is-pinned {
  background: var(--color-primary-light);
}

.news-item.is-pinned:hover {
  background: var(--color-hover-bg);
}

.news-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.25rem;
}

.news-cat {
  display: inline-block;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}

/* 活動通知 — 鼠尾草 */
.news-cat--event_notice {
  background: var(--color-secondary-light);
  color: var(--color-secondary-dark);
}

.badge-pinned {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.news-title {
  font-weight: 600;
  text-decoration: none;
  color: var(--color-text);
  word-break: break-word;
}

.news-title:hover {
  color: var(--color-primary-dark);
}

/* ----- Focus cards ----- */

.focus-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

.focus-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-secondary);
  border-radius: 8px;
  padding: 1.15rem 1.1rem;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-card);
  min-height: 100%;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

@media (hover: hover) {
  .focus-card:hover {
    border-color: var(--color-border);
    border-top-color: var(--color-primary);
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-3px);
  }
}

.focus-card h3 {
  margin: 0 0 0.35rem;
  color: var(--color-text);
  font-size: 1.1rem;
}

.focus-card p {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 0.95rem;
}

/* ----- Albums ----- */

.album-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

.album-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

@media (hover: hover) {
  .album-card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
  }
}

/* 相簿空狀態 — 淡綠虛線框 */
.section-albums .empty-state,
.section-albums-page .empty-state,
.section-album-detail .empty-state {
  background: #F3F6F1;
  border: 1px dashed #C7D5C9;
  color: var(--color-secondary);
  border-radius: 8px;
  padding: 2rem 1.25rem;
}

.album-cover {
  aspect-ratio: 16 / 10;
  background: var(--color-secondary-light);
  overflow: hidden;
}

.album-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.album-cover-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 8rem;
  color: var(--color-text-secondary);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.album-body {
  padding: 0.85rem 1rem 1rem;
}

.album-cat {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-secondary-dark);
}

.album-title {
  margin: 0.2rem 0 0.35rem;
  font-size: 1.05rem;
  color: var(--tha-text);
  word-break: break-word;
}

.album-body time {
  font-size: 0.85rem;
  color: var(--tha-muted);
}

/* ----- Placeholder / contact pages ----- */

.page-placeholder,
.page-contact {
  padding-top: 2rem;
}

.page-placeholder h1,
.page-contact h1 {
  margin: 0 0 0.5rem;
  color: var(--color-text);
  font-size: 1.6rem;
}

.contact-dl {
  margin: 1.25rem 0;
  background: var(--tha-surface);
  border: 1px solid var(--tha-border);
  border-radius: var(--tha-radius);
  padding: 0.5rem 0;
}

.contact-dl > div {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.5rem 1rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--tha-border);
}

.contact-dl > div:last-child {
  border-bottom: none;
}

.contact-dl dt {
  font-weight: 700;
  color: var(--tha-muted);
  margin: 0;
}

.contact-dl dd {
  margin: 0;
  word-break: break-word;
}

.note {
  font-size: 0.9rem;
  color: var(--tha-muted);
}

/* ----- Health (dev) ----- */

.health {
  background: var(--tha-surface);
  border: 1px solid var(--tha-border);
  border-radius: var(--tha-radius);
  padding: 1.25rem 1.5rem 1.5rem;
  margin: 1rem auto 2rem;
  max-width: var(--tha-max);
}

.health h2 {
  margin-top: 0;
  color: var(--color-text);
  font-size: 1.25rem;
}

.health .note {
  font-size: 0.9rem;
  color: var(--tha-muted);
}

.health table {
  width: 100%;
  border-collapse: collapse;
}

.health th,
.health td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--tha-border);
  vertical-align: top;
}

.health th {
  width: 10rem;
  color: #444;
  font-weight: 600;
}

.ok {
  color: var(--tha-ok);
  font-weight: 600;
}

.fail {
  color: var(--tha-fail);
  font-weight: 600;
}

code {
  font-size: 0.9em;
  background: #f0ece8;
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

/* ----- Footer ----- */

.site-footer {
  border-top: 1px solid #DED8D0;
  background: var(--color-footer);
  padding: 1.75rem 0 2rem;
  font-size: 0.9rem;
  color: #5F5954;
  margin-top: 2rem;
}

.footer-inner {
  display: grid;
  gap: 1.25rem;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.75rem;
}

.footer-org {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-primary);
}

.footer-logo {
  display: block;
  width: 7.5rem;
  height: auto;
  max-width: 100%;
}


.footer-heading {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: var(--tha-text);
}

.footer-meta {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-meta li {
  margin-bottom: 0.35rem;
  word-break: break-word;
}

.meta-label {
  display: inline-block;
  min-width: 4.5rem;
  font-weight: 600;
  color: #666;
}

.footer-social {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer-social a {
  font-weight: 600;
  text-decoration: none;
}

.footer-copy {
  margin: 0.5rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid #DED8D0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* =============================================================================
   Tablet ≥ 768px
   ============================================================================= */

@media (min-width: 768px) {
  .brand-name {
    font-size: 1.15rem;
  }

  .brand img {
    width: 64px;
  }

  .nav-toggle {
    display: none;
  }

  .header-inner {
    flex-wrap: nowrap;
  }

  .main-nav {
    display: block !important;
    width: auto;
    flex: 0 1 auto;
  }

  .nav-list {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    padding: 0;
    gap: 0.15rem;
  }

  .nav-link {
    padding: 0.45rem 0.55rem;
    font-size: 0.9rem;
  }

  .nav-link:hover,
  .nav-link.is-active {
    background: transparent;
    color: var(--color-primary);
    box-shadow: inset 0 -2px 0 var(--color-primary);
  }

  .nav-link.is-active {
    box-shadow: inset 0 -2px 0 var(--color-primary);
  }

  .nav-submenu-toggle {
    display: none;
  }

  .nav-item-row {
    display: block;
  }

  .nav-submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 11rem;
    padding: 0.35rem;
    background: var(--tha-surface);
    border: 1px solid var(--tha-border);
    border-radius: var(--tha-radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    z-index: 40;
  }

  .nav-item.has-submenu:hover > .nav-submenu,
  .nav-item.has-submenu:focus-within > .nav-submenu {
    display: block;
  }

  .nav-sublink {
    white-space: nowrap;
    font-size: 0.88rem;
    padding: 0.45rem 0.65rem;
  }

  body.nav-open {
    overflow: auto;
  }

  .hero-inner {
    flex-direction: row;
    text-align: left;
    align-items: center;
    gap: 2rem;
  }

  .hero-logo {
    width: 140px;
    margin: 0;
  }

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

  .hero-actions {
    justify-content: flex-start;
  }

  .focus-grid {
    grid-template-columns: 1fr 1fr;
  }

  .album-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-inner {
    grid-template-columns: 1fr 1.4fr;
  }

  .footer-copy {
    grid-column: 1 / -1;
  }
}

/* =============================================================================
   Desktop ≥ 1024 / 1440
   ============================================================================= */

@media (min-width: 1024px) {
  .nav-link {
    padding: 0.5rem 0.7rem;
    font-size: 0.95rem;
  }

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

  .hero-logo {
    width: 160px;
  }

  .focus-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .album-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1440px) {
  :root {
    --tha-max: 80rem;
  }
}

/* Small phones ~375 */
@media (max-width: 480px) {
  .brand-name {
    font-size: 0.95rem;
  }

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

  .health th {
    width: 7rem;
  }

  .contact-dl > div {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .hero-actions .btn {
    flex: 1 1 auto;
    min-width: 8rem;
  }
}

/* Phase 4 — news list / detail */
.section-news-page .page-header,
.section-news-detail .article-header { margin-bottom: 1.25rem; }
.page-header h1 { margin: 0 0 0.35rem; color: var(--color-text); }
.lead { color: #555; margin: 0; }
.news-filters {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.news-filters select {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--tha-border, #E7E1DA);
  border-radius: 4px;
}
.news-list-page .news-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 0;
  border-bottom: 1px solid var(--tha-border, #E7E1DA);
}
.news-thumb img {
  display: block;
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  background: #f0ebe6;
}
.news-body { flex: 1; min-width: 0; }
.breadcrumb {
  font-size: 0.9rem;
  margin-bottom: 1rem;
  color: #666;
}
.breadcrumb a { color: var(--tha-red-dark, #7E2323); }
.narrow { max-width: 800px; }
.article-cover {
  margin: 0 0 1.5rem;
}
.article-cover img {
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: cover;
  border-radius: 4px;
  background: #f0ebe6;
}
.prose { line-height: 1.75; color: var(--color-text); }
.prose p { margin: 0 0 1rem; }
.prose ul, .prose ol { margin: 0 0 1rem; padding-left: 1.25rem; }
.prose a { color: var(--tha-red-dark, #7E2323); }
.article-attachments {
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  background: #faf8f6;
  border: 1px solid var(--tha-border, #E7E1DA);
  border-radius: 4px;
}
.article-attachments h2 { margin-top: 0; font-size: 1.15rem; }
.article-back { margin-top: 2rem; }
.news-count { margin-top: 0.75rem; }
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 1.5rem;
}
.pagination a,
.pagination .page-current {
  display: inline-block;
  min-width: 2rem;
  text-align: center;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--tha-border, #E7E1DA);
  border-radius: 3px;
  text-decoration: none;
  color: var(--tha-red-dark, #7E2323);
}
.pagination .page-current {
  background: var(--tha-red, #9B2C2C);
  color: #fff;
  border-color: var(--tha-red, #9B2C2C);
}

/* ----- Phase 5: activities ----- */
.section-activities-page .page-header,
.section-activities-detail .article-header { margin-bottom: 1.25rem; }
.activity-filters { margin-bottom: 1.5rem; }
.filter-groups, .filter-subcats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
}
.filter-subcats-all { flex-direction: column; align-items: flex-start; }
.subcat-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.35rem;
}
.filter-label { font-size: 0.9rem; color: #666; margin-right: 0.25rem; }
.chip {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--tha-border, #E7E1DA);
  border-radius: 999px;
  text-decoration: none;
  color: var(--tha-red-dark, #7E2323);
  background: #fff;
  font-size: 0.95rem;
}
.chip:hover, .chip.is-active {
  background: var(--tha-red, #9B2C2C);
  color: #fff;
  border-color: var(--tha-red, #9B2C2C);
}
.chip-sm { font-size: 0.85rem; padding: 0.25rem 0.6rem; }
.activity-list { list-style: none; padding: 0; margin: 0; }
.activity-item {
  display: flex;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--tha-border, #E7E1DA);
}
.activity-item.is-past { opacity: 0.92; }
.activity-thumb img {
  display: block;
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: 3px;
  background: #f5f0eb;
}
.activity-body { flex: 1; min-width: 0; }
.activity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0.35rem;
}
.activity-cat {
  color: var(--tha-red-dark, #7E2323);
  font-weight: 600;
}
.badge-past {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  font-size: 0.75rem;
  background: #6d6d6d;
  color: #fff;
  border-radius: 3px;
}
.activity-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
}
.activity-title:hover { color: var(--tha-red, #9B2C2C); }
.activity-location, .activity-summary {
  margin: 0.35rem 0 0;
  color: #555;
  font-size: 0.95rem;
}
.activity-count { margin-top: 0.75rem; }
.activity-register { margin: 1rem 0 1.5rem; }
@media (max-width: 560px) {
  .activity-item { flex-direction: column; }
  .activity-thumb img { width: 100%; height: auto; max-height: 180px; }
}

/* Phase 6 — album gallery */
.section-albums-page .page-header,
.section-album-detail .page-header {
  margin-bottom: 1.25rem;
}
.photo-gallery {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.photo-gallery-item {
  margin: 0;
}
.photo-gallery-link {
  display: block;
  overflow: hidden;
  border-radius: 4px;
  background: #f5f0eb;
  aspect-ratio: 4 / 3;
}
.photo-gallery-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s ease;
}
.photo-gallery-link:hover img,
.photo-gallery-link:focus img {
  transform: scale(1.03);
}
.photo-caption {
  margin: 0.4rem 0 0;
  font-size: 0.875rem;
  color: #666;
}
.section-album-detail .meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.35rem;
}
.section-album-detail .breadcrumb {
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.section-album-detail .breadcrumb a {
  color: var(--tha-red, #9B2C2C);
}
.back-link {
  margin-top: 1.5rem;
}
@media (max-width: 900px) {
  .photo-gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 520px) {
  .photo-gallery {
    grid-template-columns: 1fr;
  }
}

/* Phase 7 — about / scholarship / journal / contact */
.content-pending {
  color: #8a6d3b;
  background: #fcf8e3;
  border: 1px solid #faebcc;
  padding: 0.75rem 1rem;
  border-radius: 4px;
}
.content-block {
  margin: 1.75rem 0;
}
.content-block h2 {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  color: var(--color-text);
  text-align: center;
  border-bottom: 1px solid var(--color-border-dark);
  padding-bottom: 0.5rem;
}
.download-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.download-item {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  margin-bottom: 0;
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}
.download-link {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.85rem 1rem;
  text-decoration: none;
  color: var(--color-text);
  transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}
.download-link:hover,
.download-link:focus-visible {
  background: var(--color-hover-bg);
  color: var(--color-primary);
}
.download-title {
  font-weight: 600;
}
.download-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}
.file-type {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  background: var(--color-secondary-light);
  color: var(--color-secondary-dark);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* 學會期刊：一則一則橫條（參考他站版型，配色用本站色票） */
.download-list--bars .download-item {
  border: none;
  border-radius: 6px;
  box-shadow: none;
  overflow: hidden;
}
.download-list--bars .download-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-height: 2.75rem;
  padding: 0.85rem 1.25rem;
  background: var(--color-secondary);
  color: #fff;
  text-align: center;
}
.download-list--bars .download-title {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}
.download-list--bars .download-meta {
  color: rgba(255, 255, 255, 0.85);
  justify-content: center;
}
.download-list--bars .file-type {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.download-list--bars .download-link:hover,
.download-list--bars .download-link:focus-visible {
  background: var(--color-secondary-dark);
  color: #fff;
  box-shadow: var(--shadow-card-hover);
}
@media (hover: hover) {
  .download-list--bars .download-link:hover {
    transform: translateY(-1px);
  }
}
.contact-form-title {
  margin-top: 2rem;
}
.contact-form .form-group {
  margin-bottom: 1rem;
}
.contact-form label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form input[type="tel"],
.contact-form textarea {
  width: 100%;
  max-width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--tha-border, #E7E1DA);
  border-radius: 4px;
  font: inherit;
}
.contact-form .req { color: var(--color-primary); }
.contact-form .has-error input,
.contact-form .has-error textarea {
  border-color: var(--color-primary);
}
.contact-form .field-error {
  color: var(--color-primary);
  font-size: 0.85rem;
  margin: 0.25rem 0 0;
}
.contact-form .form-actions { margin-top: 1.25rem; }
.hp-field {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.page-contact .alert,
.page-about .alert {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-radius: 4px;
}
.alert-success {
  background: #e8f5e9;
  border: 1px solid #c8e6c9;
  color: #2e7d32;
}
.alert-error {
  background: #ffebee;
  border: 1px solid #ffcdd2;
  color: #c62828;
}
.prose p { margin: 0 0 0.75rem; }
.prose ul, .prose ol { margin: 0 0 0.75rem 1.25rem; }


.page-journal h1,
.page-scholarship h1 {
  text-align: center;
  color: var(--color-text);
}
.page-journal .lead,
.page-scholarship .lead {
  text-align: center;
}
.page-journal #issues .empty-state {
  text-align: center;
  padding: 1.25rem 1rem;
}


/* Content pack 2026-09-23 — page hero + cards */
.page-hero {
  margin: 0 0 1.75rem;
  padding: 1.35rem 1.25rem 1.2rem;
  background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-surface) 55%, var(--color-secondary-light) 100%);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: 10px;
  box-shadow: var(--shadow-card);
}
.page-hero-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-secondary-dark);
}
.page-hero h1 {
  margin: 0 0 0.45rem;
  color: var(--color-primary-dark);
  font-size: clamp(1.55rem, 2.4vw, 1.9rem);
}
.page-hero .lead {
  margin: 0;
  max-width: 48rem;
}
.content-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1.25rem 1.2rem 1.35rem;
  box-shadow: var(--shadow-card);
}
.content-card h2 {
  text-align: left;
  border-bottom-color: var(--color-secondary);
  border-bottom-width: 2px;
  color: var(--color-primary-dark);
}
.page-about .prose h3,
.page-scholarship .prose h3,
.page-journal .prose h3 {
  margin: 1.15rem 0 0.45rem;
  font-size: 1.05rem;
  color: var(--color-secondary-dark);
}
.page-about .prose ul,
.page-scholarship .prose ul,
.page-journal .prose ul {
  margin-left: 0;
  padding-left: 1.2rem;
}
.field-hint {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  font-weight: 400;
}
.page-about .download-list--bars .download-link,
.page-scholarship .download-list--bars .download-link {
  background: var(--color-primary);
}
.page-about .download-list--bars .download-link:hover,
.page-about .download-list--bars .download-link:focus-visible,
.page-scholarship .download-list--bars .download-link:hover,
.page-scholarship .download-list--bars .download-link:focus-visible {
  background: var(--color-primary-dark);
}


/* Wider content pages: roomier cards on desktop */
@media (min-width: 900px) {
  .container.page-content .content-card,
  .container.page-content .page-hero {
    padding-left: 1.75rem;
    padding-right: 1.75rem;
  }
  .container.page-content .prose {
    max-width: 52rem;
  }
}
