:root {
  --red: #8c1f24;
  --red-dark: #631317;
  --gold: #b9922f;
  --gold-light: #e6cf94;
  --ink: #2a231c;
  --paper: #faf6ee;
  --card: #fffefb;
  --line: #e6dcc1;
  --muted: #7a6f5c;
  --shadow: 0 14px 34px rgba(60, 30, 10, 0.10);
  --shadow-sm: 0 4px 14px rgba(60, 30, 10, 0.07);
  --serif: "Noto Serif SC", "Songti SC", "SimSun", serif;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--red); }

h1, h2, h3 { font-family: var(--serif); }

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ------------------------------------------------------------------ header */

header.site-header {
  position: relative;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0px, rgba(255, 255, 255, 0.035) 1px, transparent 1px, transparent 13px),
    radial-gradient(ellipse at 15% -20%, rgba(255, 255, 255, 0.12), transparent 55%),
    linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  color: #fff;
  padding: 44px 0 38px;
}

header.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: linear-gradient(to right, transparent, var(--gold-light) 15%, var(--gold) 50%, var(--gold-light) 85%, transparent);
}

header.site-header .wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

header.site-header .eyebrow {
  margin: 0 0 2px;
  font-size: 12px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--gold-light);
  font-weight: 500;
}

header.site-header h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 2px;
}

header.site-header p.subtitle {
  margin: 2px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  letter-spacing: 1px;
}

.hero {
  width: 100%;
  line-height: 0;
  position: relative;
  background: var(--red-dark);
}

.hero img {
  width: 100%;
  height: auto;
  max-height: 480px;
  object-fit: cover;
  object-position: 50% 22%;
  display: block;
}

.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 70px;
  background: linear-gradient(to top, var(--paper), transparent);
  pointer-events: none;
}

@media (max-width: 600px) {
  .hero img { max-height: 220px; }
}

main {
  padding: 48px 0 90px;
}

section.intro {
  text-align: center;
  margin-bottom: 52px;
  color: var(--muted);
}

section.intro h2 {
  color: var(--ink);
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 10px;
}

section.intro p {
  max-width: 480px;
  margin: 0 auto;
}

/* ------------------------------------------------------------ section title */

h2.section-title {
  display: flex;
  align-items: center;
  gap: 18px;
  justify-content: center;
  text-align: center;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 1px;
  margin: 0 0 26px;
  color: var(--ink);
}

h2.section-title::before,
h2.section-title::after {
  content: "";
  flex: 1;
  max-width: 90px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold));
}

h2.section-title::after { background: linear-gradient(to left, transparent, var(--gold)); }

section + h2.section-title,
.announcement-list + h2.section-title {
  margin-top: 60px;
}

/* --------------------------------------------------------------- announcements */

.announcement-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.announcement-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 30px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

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

.announcement-card.pinned {
  border-color: var(--gold);
  background: linear-gradient(180deg, #fdf6e4 0%, #fffefb 90px);
}

.announcement-card .badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.badge {
  display: inline-block;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--gold);
  color: #453208;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge.date {
  background: #f4ead0;
  color: var(--red-dark);
}

.announcement-card h3 {
  margin: 0 0 14px;
  font-size: 22px;
  font-weight: 700;
  color: var(--red-dark);
  line-height: 1.45;
}

.announcement-poster {
  position: relative;
  display: block;
  width: 200px;
  max-width: 55%;
  margin: 0 auto 20px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.announcement-poster:hover,
.announcement-poster:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.announcement-poster img {
  display: block;
  width: 100%;
  height: auto;
}

.poster-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 6px 8px;
  font-size: 11px;
  color: #fff;
  text-align: center;
  background: linear-gradient(to top, rgba(20, 10, 5, 0.75), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.announcement-poster:hover .poster-hint,
.announcement-poster:focus-visible .poster-hint {
  opacity: 1;
}

.announcement-body {
  white-space: pre-wrap;
  color: var(--ink);
  font-size: 15px;
}

.meta-line {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.3px;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 60px 0;
}

/* -------------------------------------------------------------------- gallery */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 130px;
  grid-auto-flow: dense;
  gap: 14px;
}

.gallery-thumb:first-child {
  grid-column: span 2;
  grid-row: span 2;
}

.gallery-thumb {
  position: relative;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

/* Only applied by JS right before observing, so a no-JS visitor always sees
   the photos - the reveal animation is a bonus, never a requirement. */
.gallery-thumb.reveal-pending {
  opacity: 0;
  transform: translateY(16px);
}

.gallery-thumb.in-view {
  opacity: 1;
  transform: translateY(0);
  transition: box-shadow 0.25s ease, transform 0.25s ease, opacity 0.6s ease;
}

.gallery-thumb:hover,
.gallery-thumb:focus-visible {
  box-shadow: var(--shadow);
  transform: translateY(-3px);
  z-index: 1;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.gallery-thumb:hover img,
.gallery-thumb:focus-visible img {
  transform: scale(1.08);
}

.gallery-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(20, 10, 5, 0.65), transparent 60%);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.gallery-thumb:hover::after,
.gallery-thumb:focus-visible::after {
  opacity: 1;
}

.gallery-caption {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 1;
  text-align: left;
}

.gallery-thumb:hover .gallery-caption,
.gallery-thumb:focus-visible .gallery-caption {
  opacity: 1;
  transform: translateY(0);
}

.gallery-thumb:first-child .gallery-caption {
  font-size: 16px;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(18, 10, 6, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: fade-in 0.2s ease;
}

.lightbox[hidden] { display: none; }

.lightbox-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
}

.lightbox img {
  max-width: 100%;
  max-height: 82vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: lightbox-swap 0.25s ease;
}

.lightbox-figure figcaption {
  margin-top: 14px;
  color: #f3e6c8;
  font-size: 14px;
  letter-spacing: 0.5px;
  text-align: center;
}

.lightbox-counter {
  position: absolute;
  top: 20px;
  left: 24px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  letter-spacing: 1px;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 24px;
  background: none;
  border: none;
  color: #fff;
  font-size: 36px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.lightbox-close:hover { opacity: 1; }

.lightbox-nav {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.2s ease, background 0.2s ease;
  flex-shrink: 0;
  margin: 0 18px;
}

.lightbox-nav:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.18);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes lightbox-swap {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 600px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 90px; gap: 8px; }
  .lightbox-nav { width: 36px; height: 36px; margin: 0 8px; font-size: 14px; }
  .lightbox-counter { top: 12px; left: 16px; }
}

/* --------------------------------------------------------------- suggestion box */

.suggestion-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 30px 32px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.suggestion-box::before {
  content: "";
  position: absolute;
  top: -30px;
  right: -30px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(185, 146, 47, 0.14), transparent 70%);
}

.suggestion-intro {
  margin: 0 0 20px;
  color: var(--muted);
  text-align: center;
}

.suggestion-box form {
  max-width: 480px;
  margin: 0 auto;
}

.hp-field {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.suggestion-box textarea {
  min-height: 120px;
}

.suggestion-box .form-actions {
  justify-content: center;
}

.suggestion-success {
  text-align: center;
  color: #4a7a4a;
  font-weight: 600;
  margin-top: 14px;
}

/* -------------------------------------------------------------------- footer */

footer.site-footer {
  border-top: 1px solid var(--line);
  padding: 30px 0 44px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.3px;
}

footer.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

footer.site-footer a:hover { color: var(--red); }

/* ---------------------------------------------------------------- admin */

.admin-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

.login-box {
  max-width: 360px;
  margin: 80px auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 34px;
  box-shadow: var(--shadow);
  text-align: center;
}

.login-box h1 {
  font-size: 20px;
  margin-bottom: 20px;
}

input[type="text"],
input[type="password"],
input[type="date"],
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(185, 146, 47, 0.15);
}

textarea {
  min-height: 220px;
  resize: vertical;
  white-space: pre-wrap;
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
  margin-top: 14px;
}

label:first-child { margin-top: 0; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.checkbox-row input { width: auto; }

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 600;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

button.primary {
  background: var(--red);
  color: #fff;
}

button.primary:hover {
  background: var(--red-dark);
  box-shadow: 0 6px 16px rgba(140, 31, 36, 0.3);
  transform: translateY(-1px);
}

button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

button.ghost:hover { border-color: var(--gold); color: var(--ink); }

button.danger {
  background: #fff;
  color: #b3261e;
  border: 1px solid #f0c9c4;
}

button.danger:hover { background: #fdecea; }

.error-msg {
  color: #b3261e;
  font-size: 13px;
  margin-top: 10px;
  min-height: 16px;
}

.admin-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 24px;
}

.admin-header > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.admin-header h1 { font-size: 20px; margin: 0; }

.form-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.admin-list-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 14px;
}

.admin-list-item .row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.admin-list-item h3 { margin: 0 0 6px; font-size: 17px; }

.admin-list-item .actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.admin-list-item .preview {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
  white-space: pre-wrap;
  max-height: 4.5em;
  overflow: hidden;
}

@media (max-width: 600px) {
  header.site-header h1 { font-size: 24px; }
  .announcement-card { padding: 20px; }
  .admin-list-item .row { flex-direction: column; }
  h2.section-title::before,
  h2.section-title::after { max-width: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
