/* 石霧洞 Cheo Bu Tong Temple — site styles */
:root {
  --lacquer: #3a1f14;
  --lacquer-2: #4b2a1c;
  --vermilion: #a3201c;
  --vermilion-dark: #7d1613;
  --gold: #c9a23a;
  --gold-light: #e6c66e;
  --paper: #fffcf5;
  --paper-2: #f6efe0;
  --ink: #231815;
  --ink-soft: #5a4a42;
  --line: #e2d5bc;
  --focus: #1b5fd1;

  --fs-base: 20px;
  --serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --wrap: 1120px;
}

html { font-size: var(--fs-base); }
html.text-lg { --fs-base: 23px; }
html.text-xl { --fs-base: 26px; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.75;
  -webkit-text-size-adjust: 100%;
}

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

a { color: var(--vermilion); text-underline-offset: 0.18em; }
a:hover { color: var(--vermilion-dark); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3 { font-family: var(--serif); line-height: 1.35; margin: 0 0 0.5em; font-weight: 700; }
h1 { font-size: 2rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; max-width: 38em; }

/* Language switching: only the active language shows */
html[lang="zh-Hans"] [lang="en"]:not(html) { display: none !important; }
html[lang="en"] [lang="zh-Hans"]:not(html) { display: none !important; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 100; background: #fff; padding: 8px 12px; }

/* ---------- Top utility bar ---------- */
.topbar { background: var(--lacquer); color: #f3e7cf; font-size: 0.9rem; }
.topbar .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between; padding-top: 8px; padding-bottom: 8px; }
.topbar a { color: var(--gold-light); font-weight: 700; text-decoration: none; }
.topbar a:hover { text-decoration: underline; color: #fff; }
.tools { display: flex; gap: 10px; flex-wrap: wrap; }

.toggle {
  display: inline-flex; border: 2px solid var(--gold); border-radius: 999px; overflow: hidden;
}
.toggle button {
  font: inherit; font-weight: 700; background: transparent; color: #f3e7cf; border: 0;
  padding: 4px 16px; cursor: pointer; min-height: 44px;
}
.toggle button[aria-pressed="true"] { background: var(--gold); color: var(--lacquer); }

/* ---------- Header / nav ---------- */
.site-header { background: var(--paper); border-bottom: 4px solid var(--vermilion); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); }
.brand-seal {
  width: 56px; height: 56px; flex: none; border-radius: 6px;
  background: var(--vermilion); color: var(--paper);
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 1.45rem; font-weight: 900;
  box-shadow: inset 0 0 0 3px var(--vermilion), inset 0 0 0 5px var(--gold-light);
}
.brand-name { font-family: var(--serif); font-size: 1.45rem; font-weight: 900; line-height: 1.2; display: block; }
.brand-sub { font-size: 0.85rem; color: var(--ink-soft); display: block; }

.nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.nav a {
  display: block; padding: 8px 14px; min-height: 44px; border-radius: 6px;
  color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.05rem;
}
.nav a:hover { background: var(--paper-2); color: var(--vermilion-dark); }
.nav a[aria-current="page"] { background: var(--vermilion); color: #fff; }

.menu-btn { display: none; }

@media (max-width: 860px) {
  .menu-btn {
    display: inline-flex; align-items: center; gap: 8px; font: inherit; font-weight: 700;
    background: var(--lacquer); color: #fff; border: 0; border-radius: 6px; padding: 8px 16px; min-height: 48px; cursor: pointer;
  }
  .nav { flex-basis: 100%; display: none; }
  .nav.open { display: block; }
  .nav ul { flex-direction: column; }
  .nav a { font-size: 1.15rem; padding: 12px 14px; border-bottom: 1px solid var(--line); border-radius: 0; }
}

/* ---------- Hero: the temple signboard ---------- */
.hero { background: var(--lacquer); color: #f7ecd5; padding: 48px 0 56px; position: relative; overflow: hidden; }
.hero::before {
  /* faint lattice, like carved temple window screens */
  content: ""; position: absolute; inset: 0; opacity: 0.08; pointer-events: none;
  background-image:
    linear-gradient(var(--gold) 2px, transparent 2px),
    linear-gradient(90deg, var(--gold) 2px, transparent 2px);
  background-size: 36px 36px;
}
.plaque {
  position: relative; max-width: 760px; margin: 0 auto; text-align: center;
  background: linear-gradient(180deg, var(--lacquer-2), #2c160e);
  border: 6px solid var(--gold);
  outline: 2px solid var(--gold); outline-offset: 6px;
  padding: 28px 20px 30px; border-radius: 4px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}
.plaque-title {
  font-family: var(--serif); font-weight: 900; color: var(--gold-light);
  font-size: clamp(3.2rem, 12vw, 6.4rem); letter-spacing: 0.25em; line-height: 1.1;
  margin: 0; padding-left: 0.25em; /* balance trailing letter-spacing */
  text-shadow: 0 2px 0 #5a3a12, 0 0 24px rgba(230, 198, 110, 0.25);
}
.plaque-deity { font-family: var(--serif); font-size: 1.5rem; color: #f7ecd5; margin: 10px 0 0; letter-spacing: 0.12em; }
.plaque-en { font-size: 1rem; color: #d8c49a; margin: 6px 0 0; letter-spacing: 0.04em; }

.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 36px; position: relative; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font: inherit; font-weight: 700; font-size: 1.1rem; text-decoration: none; cursor: pointer;
  padding: 12px 24px; min-height: 56px; border-radius: 8px; border: 2px solid transparent;
}
.btn svg { width: 1.2em; height: 1.2em; flex: none; }
.btn-red { background: var(--vermilion); color: #fff; }
.btn-red:hover { background: var(--vermilion-dark); color: #fff; }
.btn-gold { background: var(--gold); color: var(--lacquer); }
.btn-gold:hover { background: var(--gold-light); color: var(--lacquer); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: #fff; }
.hero .btn-ghost { color: #f7ecd5; border-color: #f7ecd5; }
.hero .btn-ghost:hover { background: #f7ecd5; color: var(--lacquer); }

/* ---------- Sections ---------- */
main { display: block; }
.section { padding: 56px 0; }
.section-alt { background: var(--paper-2); }
.page-head { background: var(--paper-2); border-bottom: 1px solid var(--line); padding: 40px 0 28px; }
.page-head p { color: var(--ink-soft); font-size: 1.05rem; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 28px; }

/* Info list: address / phone / hours */
.facts { list-style: none; margin: 0; padding: 0; }
.facts li { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.facts li:last-child { border-bottom: 0; }
.facts .k { flex: none; width: 5.5em; font-weight: 700; color: var(--ink-soft); }
.facts .v { font-size: 1.1rem; }
.facts a { font-weight: 700; }

/* Notice board — red paper notice like those pasted at temples */
.notice {
  background: var(--vermilion); color: #fff7e6; border-radius: 6px; padding: 28px 26px;
  border: 3px solid var(--gold); position: relative;
}
.notice h2, .notice h3 { color: var(--gold-light); }
.notice .when { font-family: var(--serif); font-size: 1.3rem; font-weight: 700; margin-bottom: 0.4em; }
.notice .lunar { color: #ffe6b3; }
.notice .price { display: inline-block; background: var(--paper); color: var(--vermilion-dark); font-weight: 900; font-size: 1.4rem; padding: 4px 14px; border-radius: 4px; margin: 6px 0 14px; }
.notice a { color: var(--gold-light); }

.panel { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 26px; }

/* Facebook posts (from data/posts.json) */
.posts { display: grid; gap: 20px; }
.posts-empty { background: #fff; border: 1px dashed var(--line); border-radius: 6px; padding: 20px; }
.post { background: #fff; border: 1px solid var(--line); border-left: 6px solid var(--vermilion); border-radius: 6px; overflow: hidden; }
.post img { width: 100%; max-height: 640px; object-fit: contain; background: var(--paper-2); }
.post-body { padding: 18px 22px 20px; }
.post time { display: block; font-family: var(--serif); font-weight: 700; color: var(--vermilion-dark); font-size: 1.1rem; margin-bottom: 6px; }
.post-text { font-size: 1.1rem; margin-bottom: 0.6em; }
.post a { font-weight: 700; }
.fb-fallback { margin-top: 20px; }
.updates-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 36px; align-items: start; }
@media (max-width: 900px) { .updates-layout { grid-template-columns: 1fr; } }

/* Gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.gallery figure { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.gallery figcaption { padding: 10px 14px; font-size: 0.95rem; }
.gallery .ph { aspect-ratio: 4 / 3; display: grid; place-items: center; background: var(--paper-2); color: var(--ink-soft); font-family: var(--serif); font-size: 2.4rem; }

/* Donation */
.pay { display: grid; gap: 18px; }
.pay .panel h3 { color: var(--vermilion-dark); }
.qr { width: 220px; height: 220px; border: 2px dashed var(--line); display: grid; place-items: center; color: var(--ink-soft); font-size: 0.9rem; text-align: center; padding: 12px; background: #fff; }
.qr-img { width: 100%; max-width: 320px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.big-num { font-family: var(--serif); font-size: 1.5rem; font-weight: 700; letter-spacing: 0.04em; }

.map { width: 100%; height: 380px; border: 1px solid var(--line); border-radius: 6px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--lacquer); color: #e7d8bb; padding: 40px 0 28px; margin-top: 0; }
.site-footer a { color: var(--gold-light); }
.site-footer .name { font-family: var(--serif); font-size: 1.4rem; color: var(--gold-light); font-weight: 900; }
.site-footer small { display: block; margin-top: 24px; color: #b9a585; font-size: 0.85rem; }

@media (max-width: 560px) {
  h1 { font-size: 1.7rem; }
  h2 { font-size: 1.4rem; }
  .btn { width: 100%; }
  .facts li { flex-direction: column; gap: 2px; }
  .plaque { outline-offset: 4px; padding: 22px 12px 24px; }
  .plaque-deity { font-size: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Facebook page card (official Page Plugin, header only) */
.fb-card { margin-bottom: 20px; }
.fb-card iframe { display: block; border: 0; max-width: 100%; }
