/* Rex Music Charity Music Foundation — hand-drawn / warm aesthetic
   Design tokens per brand brief: plain off-white canvas, Morandi green × goose yellow */
:root {
  /* Color palette */
  --bg-canvas: #f6f5f0;
  --paper: #ffffff;
  --wash: #faf8f1;
  --ink: #2b2b2b;
  --muted: #555555;
  --line: #e4e0d4;

  --accent: #7ca88a;        /* Morandi green — primary */
  --accent-dark: #5c8a6c;
  --accent-yellow: #e4c478; /* goose yellow — secondary */
  --accent-yellow-dark: #cf9f3f;

  /* Typography: Kalam (EN handwriting) for Latin display;
     ALL Chinese renders 黑體 (heiti) — PingFang / Microsoft JhengHei / Noto Sans TC.
     --serif/--sans names kept so every existing heading/body rule picks up the faces. */
  --serif: "Kalam", "PingFang HK", "PingFang TC", "Heiti TC", "Microsoft JhengHei",
    "Noto Sans TC", sans-serif;
  --sans: "Noto Sans TC", "PingFang HK", "PingFang TC", "Microsoft JhengHei", sans-serif;

  /* Layout & spacing */
  --card-radius: 20px;
  --card-border-width: 4px;
  --space-sm: 0.75rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  background-color: var(--bg-canvas); /* plain off-white */
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* Crayon doodle background canvas — behind all content, above the page canvas */
#doodle-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
}

@media print {
  #doodle-canvas { display: none; }
}

.container { width: min(980px, 92%); margin: 0 auto; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.brand img { height: 64px; width: auto; }

.brand-name {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.02em;
}

.brand-name small {
  display: block;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.main-nav ul {
  display: flex;
  align-items: center;
  gap: 26px;
  flex-wrap: wrap;
}

.main-nav a {
  font-size: 15px;
  letter-spacing: 0.05em;
  padding: 6px 0;
  position: relative;
  white-space: nowrap;
}

.main-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 0;
  height: 1.5px;
  background: var(--accent);
  transition: right 0.25s ease;
}

.main-nav a:hover::after,
.main-nav a[aria-current="page"]::after { right: 0; }

.main-nav a[aria-current="page"] { color: var(--accent-dark); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 18px;
  cursor: pointer;
  color: var(--ink);
}

/* ---------- Hero (home) ---------- */
.hero { text-align: center; padding: 72px 0 40px; }

.hero .en {
  font-family: var(--serif);
  font-size: clamp(22px, 3.4vw, 34px);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(34px, 5.6vw, 56px);
  letter-spacing: 0.06em;
  margin-top: 6px;
}

.hero .rule {
  width: 72px;
  height: 2px;
  background: var(--accent);
  margin: 26px auto 0;
}

/* ---------- Slideshow ---------- */
.slideshow {
  position: relative;
  margin: 34px auto 0;
  max-width: 980px;
  aspect-ratio: 16 / 9;
  background: var(--wash);
  overflow: hidden;
}

.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.9s ease;
}

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

.slide.active { opacity: 1; pointer-events: auto; }

/* inactive slides sit stacked on top; keep them out of the way of clicks */
.slide { pointer-events: none; }

.slideshow .arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  font-size: 18px;
  cursor: pointer;
  transition: background 0.2s ease;
  z-index: 2;
}

.slideshow .arrow:hover { background: #fff; }

.slideshow .arrow.prev { left: 14px; }
.slideshow .arrow.next { right: 14px; }

.slideshow .dots {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 10px;
  z-index: 2;
}

.slideshow .dots button {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.slideshow .dots button.active {
  background: var(--accent);
  transform: scale(1.35);
}

/* ---------- Generic page layout ---------- */
.page { padding: 56px 0 40px; }

.page-title {
  font-family: var(--serif);
  font-weight: 600;
  text-align: center;
  font-size: clamp(30px, 4.4vw, 44px);
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.page-title.with-rule::after {
  content: "";
  display: block;
  width: 56px;
  height: 2px;
  background: var(--accent);
  margin: 18px auto 0;
}

.page-sub {
  text-align: center;
  color: var(--muted);
  margin-bottom: 36px;
}

.prose { max-width: 760px; margin: 0 auto; }

.prose p { margin-bottom: 1.1em; }
.prose .lead { font-size: 19px; }

.prose h2,
.prose h3 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: 0.03em;
  margin: 1.6em 0 0.6em;
  line-height: 1.4;
}

.prose h2 { font-size: clamp(26px, 3.6vw, 34px); }
.prose h3 { font-size: clamp(21px, 3vw, 26px); }

.prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 6px 0 6px 20px;
  margin: 1.2em 0;
  font-family: var(--serif);
  font-size: 21px;
}

.prose ul.bullets { list-style: disc; padding-left: 1.4em; }
.prose ul.bullets li { margin-bottom: 0.5em; }

.prose a { color: var(--accent-dark); border-bottom: 1px solid currentColor; }

.figure { margin: 30px 0; text-align: center; }

.figure img {
  margin: 0 auto;
  border: 1px solid var(--line);
}

.figure figcaption {
  margin-top: 10px;
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ---------- Home: support section ---------- */
.support {
  background: var(--wash);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 64px 0 72px;
  margin-top: 56px;
  text-align: center;
}

.support .prose { text-align: left; }

.support h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(28px, 4vw, 38px);
  letter-spacing: 0.08em;
  margin-bottom: 22px;
  text-align: center;
}

.support h2::after {
  content: "";
  display: block;
  width: 56px;
  height: 2px;
  background: var(--accent);
  margin: 16px auto 0;
}

.bank-card {
  margin-top: 28px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 26px 30px;
  text-align: center;
}

.bank-card .bank { font-weight: 700; }

.bank-card .acct {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent-dark);
  margin: 6px 0;
}

.bank-card .acct-name { font-size: 15px; color: var(--muted); }

/* ---------- Activities hub & sub-pages ---------- */
.back-link {
  display: inline-block;
  margin-top: 14px;
  color: var(--muted);
  font-size: 14.5px;
  letter-spacing: 0.05em;
}

.back-link:hover { color: var(--accent-dark); }

.hub-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: 34px;
}

.hub-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.hub-card:hover {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  transform: translateY(-3px);
}

.hub-card .thumb {
  aspect-ratio: 3 / 4; /* portrait frame matches the posters instead of cropping them */
  overflow: hidden;
  background: var(--wash);
}

.hub-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top; /* posters keep their title/heading visible */
  transition: transform 0.35s ease;
}

.hub-card:hover .thumb img { transform: scale(1.04); }

.hub-card .body {
  padding: 22px 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.hub-card .body h2 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.hub-card .body p { color: var(--muted); font-size: 15.5px; }

.hub-card .more {
  margin-top: auto;
  color: var(--accent-dark);
  font-weight: 500;
  letter-spacing: 0.1em;
  font-size: 15px;
}

.district-badges { display: flex; flex-wrap: wrap; gap: 8px; }

.district-badges span {
  border: 1px solid var(--accent);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 3px 14px;
  font-size: 13.5px;
  letter-spacing: 0.08em;
}

.district { margin-top: 44px; }

.district h3 {
  display: flex;
  align-items: center;
  gap: 12px;
}

.district h3::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.district .figure { margin: 18px 0 0; }

@media (max-width: 700px) {
  .hub-grid { grid-template-columns: 1fr; }
}

/* ---------- Image grid (activities) ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 34px 0;
}

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

.grid figure {
  background: var(--wash);
  border: 1px solid var(--line);
  overflow: hidden;
}

.grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  aspect-ratio: 3 / 4;
  transition: transform 0.35s ease;
}

.grid .landscape img { aspect-ratio: 4 / 3; }

.grid figure:hover img { transform: scale(1.03); }

/* ---------- Management / Leadership ---------- */
.leadership-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md) 64px;
}

.leadership-header {
  text-align: center;
  margin-bottom: var(--space-lg);
}

.leadership-title {
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.3;
}

.leadership-en {
  font-family: "Kalam", cursive, sans-serif;
  font-size: 1.35rem;
  color: var(--accent-dark);
  margin-top: 2px;
}

.leadership-sub {
  color: var(--muted);
  margin-top: 10px;
  letter-spacing: 0.12em;
}

.leadership-header::after {
  content: "";
  display: block;
  width: 64px;
  height: 3px;
  border-radius: 3px;
  margin: 20px auto 0;
  background: linear-gradient(to right, var(--accent) 50%, var(--accent-yellow) 50%);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-lg);
  align-items: stretch;
}

.leadership-card {
  position: relative;
  background: var(--paper);
  border-radius: var(--card-radius);
  padding: var(--space-lg);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.leadership-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.08);
}

/* Card theme variants */
.leadership-card--green {
  border: var(--card-border-width) solid var(--accent);
}

.leadership-card--yellow {
  border: var(--card-border-width) solid var(--accent-yellow);
}

.leadership-card--plain {
  border: 3px dashed var(--line);
}

.card-role {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
  display: block;
}

.leadership-card--green .card-role { color: var(--accent-dark); }
.leadership-card--yellow .card-role { color: var(--accent-yellow-dark); }
.leadership-card--plain .card-role { color: var(--muted); }

.card-name {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.card-bio {
  color: var(--muted);
  font-size: 1rem;
  text-align: justify;
}

/* Hand-drawn doodle monsters (inline SVG stickers on card corners) */
.doodle {
  position: absolute;
  width: 96px;
  height: 96px;
  pointer-events: none;
  filter: drop-shadow(2px 3px 0 rgba(0, 0, 0, 0.06));
}

.doodle--tl { top: -34px; left: -34px; --r: -8deg; transform: rotate(var(--r)); }
.doodle--br { bottom: -26px; right: -26px; --r: 8deg; transform: rotate(var(--r)); }

.leadership-card:hover .doodle { animation: doodle-wiggle 0.6s ease-in-out; }

@keyframes doodle-wiggle {
  0%, 100% { transform: rotate(var(--r)); }
  25% { transform: rotate(calc(var(--r) + 9deg)); }
  75% { transform: rotate(calc(var(--r) - 9deg)); }
}

@media (prefers-reduced-motion: reduce) {
  .leadership-card:hover .doodle { animation: none; }
  .leadership-card, .hub-card, .grid figure:hover img { transition: none; }
}

/* High-contrast fallback: darkened tokens for stronger separation */
@media (prefers-contrast: high) {
  :root {
    --line: #8a8578;
    --muted: #3c3c3c;
    --accent-yellow: #c9a23f;
  }

  .leadership-card--green { border-color: #3f6b4f; }
  .leadership-card--yellow { border-color: #8a6d1f; }
}

@media (max-width: 700px) {
  .doodle { width: 72px; height: 72px; }
  .doodle--tl { top: -24px; left: -24px; }
  .doodle--br { bottom: -18px; right: -18px; }
}

/* ---------- Contact ---------- */
.contact-list {
  margin-top: 26px;
  border-top: 1px solid var(--line);
}

.contact-list li {
  display: flex;
  gap: 16px;
  padding: 16px 4px;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}

.contact-list .label {
  flex: 0 0 190px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.contact-list a { color: var(--accent-dark); border-bottom: 1px solid currentColor; }

.org-badge {
  text-align: center;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.org-sub {
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 8px;
}

/* ---------- Facebook preview ---------- */
.fb-section {
  padding: 56px 0 68px;
  text-align: center;
}

.fb-section h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(26px, 3.6vw, 34px);
  letter-spacing: 0.08em;
}

.fb-section h2::after {
  content: "";
  display: block;
  width: 56px;
  height: 2px;
  background: var(--accent);
  margin: 14px auto 0;
}

.fb-section .sub {
  color: var(--muted);
  margin: 14px 0 26px;
}

.fb-embed {
  display: flex;
  justify-content: center;
}

.fb-embed iframe {
  width: 500px;
  max-width: 100%;
  height: 700px;
  border: none;
  border-radius: 12px;
  background: #fff;
}

.fb-section .ig-btn { margin-top: 26px; }

/* ---------- CTA strip ---------- */
.cta-strip {
  margin-top: 56px;
  background: var(--ink);
  color: #fff;
  text-align: center;
  padding: 44px 20px;
}

.cta-strip .line { font-family: var(--serif); font-size: clamp(22px, 3vw, 28px); letter-spacing: 0.05em; }

.cta-strip .sub { color: #cfc9c0; font-size: 15px; margin: 8px 0 18px; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 10px 34px;
  font-size: 16px;
  letter-spacing: 0.08em;
  transition: background 0.2s ease;
}

.btn:hover { background: var(--accent-dark); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 44px 0 90px;
  text-align: center;
  color: var(--muted);
  font-size: 14.5px;
}

.site-footer img { height: 56px; margin: 0 auto 12px; }

.site-footer .name {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
}

.site-footer a { color: var(--accent-dark); border-bottom: 1px solid currentColor; }

.site-footer .social {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
}

.site-footer .social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border-bottom: none;
  transition: background 0.2s ease, transform 0.2s ease;
}

.site-footer .social a:hover { background: var(--accent-dark); transform: translateY(-2px); }

.site-footer .copy { margin-top: 10px; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(24, 24, 22, 0.88);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  cursor: zoom-out;
}

.lightbox.open { opacity: 1; pointer-events: auto; }

.lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  transform: scale(0.96);
  transition: transform 0.25s ease;
}

.lightbox.open img { transform: scale(1); }

/* Images that open the lightbox */
main .figure img,
main .grid img,
main .slideshow img { cursor: zoom-in; }

@media (prefers-reduced-motion: reduce) {
  .lightbox, .lightbox img { transition: none; }
}

/* ---------- Back to top ---------- */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 26px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 40;
}

.to-top.show { opacity: 1; pointer-events: auto; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 10px 4vw 18px;
  }

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

  .main-nav ul {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .nav-toggle { display: block; }

  .grid { grid-template-columns: repeat(2, 1fr); }
  .grid.four { grid-template-columns: repeat(2, 1fr); }
  .brand img { height: 50px; }
  .hero { padding-top: 48px; }
}

@media (max-width: 540px) {
  body { font-size: 16px; }
  .grid { grid-template-columns: 1fr; }
  .contact-list li { flex-direction: column; gap: 2px; }
  .contact-list .label { flex-basis: auto; }
  .slideshow .arrow { width: 36px; height: 36px; }
}
