:root {
  --ink: #17312a;
  --muted: #65746f;
  --line: #dce5dd;
  --paper: #fbfcf8;
  --white: #ffffff;
  --mint: #dcefe0;
  --mint-strong: #b8dfc1;
  --leaf: #2f7d58;
  --leaf-dark: #1f5f42;
  --clay: #b66346;
  --sun: #f5c863;
  --sky: #d8eef1;
  --shadow: 0 18px 50px rgba(23, 49, 42, 0.14);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
h1, h2, h3, p { margin-top: 0; }

/* ─── Topbar ─────────────────────────────────────────────────────────────── */

.topbar {
  align-items: center;
  background: rgba(251, 252, 248, 0.95);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  min-height: 74px;
  padding: 12px clamp(18px, 5vw, 64px);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
}
.brand { align-items: center; display: flex; gap: 12px; }
.brand-mark {
  align-items: center;
  background: var(--leaf);
  border-radius: 8px;
  color: white;
  display: inline-flex;
  font-weight: 800;
  height: 44px;
  justify-content: center;
  width: 44px;
  flex-shrink: 0;
}
.logo-img {
  height: 44px;
  width: auto;
  max-width: 120px;
  border-radius: 8px;
  object-fit: contain;
  flex-shrink: 0;
}
.brand strong { display: block; }
.brand small { color: var(--muted); display: block; margin-top: 2px; }
nav { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
nav a {
  border-radius: 8px;
  color: var(--muted);
  font-weight: 700;
  padding: 10px 11px;
}
nav a:hover { background: var(--mint); color: var(--ink); }
nav a.active { background: var(--ink); color: white; }

/* ─── Page routing ──────────────────────────────────────────────────────── */

.page-view:not(.active) { display: none !important; }
.page-view.active { display: block; }
.hero.page-view.active { display: grid; }
.contact-section.page-view.active { display: flex; }

/* ─── Hero ───────────────────────────────────────────────────────────────── */

.hero {
  background:
    linear-gradient(90deg, rgba(23, 49, 42, 0.88), rgba(23, 49, 42, 0.36)),
    url("https://images.unsplash.com/photo-1544367567-0f2fcb009e0b?auto=format&fit=crop&w=1800&q=85") center/cover;
  background-size: cover;
  background-position: center;
  color: white;
  display: grid;
  gap: clamp(24px, 5vw, 64px);
  grid-template-columns: minmax(0, 1fr) 360px;
  min-height: calc(100vh - 74px);
  padding: clamp(48px, 8vw, 104px) clamp(18px, 5vw, 64px);
  transition: background-image 0.4s ease;
}
.hero-copy { align-self: center; max-width: 790px; }
.eyebrow {
  color: var(--clay);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  margin-bottom: 10px;
  text-transform: uppercase;
}
.hero .eyebrow { color: var(--sun); }
h1 {
  font-family: "Noto Serif", Georgia, serif;
  font-size: clamp(2.4rem, 6vw, 5.4rem);
  line-height: 0.98;
  margin-bottom: 22px;
}
h2 { font-size: clamp(1.85rem, 3.5vw, 3.2rem); line-height: 1.05; margin-bottom: 0; }
h3 { font-size: 1.08rem; }
.hero-copy > p:not(.eyebrow) {
  color: rgba(255, 255, 255, 0.86);
  font-size: 1.08rem;
  line-height: 1.7;
  max-width: 640px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn {
  align-items: center;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 46px;
  padding: 12px 18px;
  transition: background 0.15s, opacity 0.15s;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn.primary { background: var(--leaf); color: white; }
.btn.primary:hover:not(:disabled) { background: var(--leaf-dark); }
.btn.quiet { background: var(--mint); color: var(--ink); }
.hero .btn.quiet { background: rgba(255, 255, 255, 0.9); }
.hero-panel {
  align-self: end;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--ink);
  display: grid;
  gap: 1px;
  overflow: hidden;
}
.hero-panel div { background: white; padding: 22px; }
.hero-panel span { display: block; font-size: 1.9rem; font-weight: 800; }
.hero-panel p { color: var(--muted); margin: 6px 0 0; }

/* ─── Sections ───────────────────────────────────────────────────────────── */

.section { padding: clamp(52px, 7vw, 92px) clamp(18px, 5vw, 64px); }
.section-head {
  align-items: end;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin-bottom: 28px;
}
.section-intro {
  color: var(--muted);
  line-height: 1.7;
  margin: 0;
  max-width: 470px;
}

/* ─── About ──────────────────────────────────────────────────────────────── */

.about-section { background: var(--white); }
.about-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.about-grid article {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 210px;
  padding: 22px;
}
.about-grid h3 { margin-bottom: 12px; }
.about-grid p { color: var(--muted); line-height: 1.65; margin-bottom: 0; }

/* ─── Events ─────────────────────────────────────────────────────────────── */

.events-section {
  background: linear-gradient(180deg, #f7fbf6, #ffffff);
}
.filters, .tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.chip, .tab {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  min-height: 40px;
  padding: 9px 12px;
}
.chip.active, .tab.active { background: var(--ink); color: white; }

.event-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.event-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 100%;
  box-shadow: 0 10px 30px rgba(23, 49, 42, 0.07);
}
.event-card img {
  aspect-ratio: 16 / 10;
  object-fit: cover;
  width: 100%;
}
.event-body { display: flex; flex: 1; flex-direction: column; gap: 10px; padding: 18px; }
.badge {
  align-self: flex-start;
  background: var(--sky);
  border-radius: 999px;
  color: #21545a;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 6px 10px;
}
.event-meta { color: var(--muted); display: grid; gap: 5px; font-size: 0.92rem; }
.event-card p { color: var(--muted); line-height: 1.55; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.card-actions .btn { min-height: 40px; padding: 9px 12px; }

/* ─── Notices ────────────────────────────────────────────────────────────── */

.notices-band {
  background: #eef6ef;
  border-block: 1px solid var(--line);
}
.notice-list { display: grid; gap: 12px; }
.notice-item {
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 16px;
  grid-template-columns: 150px 1fr auto;
  padding: 18px;
}
.notice-item time, .notice-item p { color: var(--muted); margin: 0; }
.view-pdf-btn {
  align-items: center;
  display: inline-flex;
  gap: 4px;
  white-space: nowrap;
}

/* ─── Contact ────────────────────────────────────────────────────────────── */

.contact-section {
  align-items: center;
  background: var(--ink);
  color: white;
  display: flex;
  gap: 24px;
  justify-content: space-between;
}
.contact-section .eyebrow { color: var(--sun); }
.contact-section p { color: rgba(255, 255, 255, 0.78); line-height: 1.7; margin: 12px 0 0; max-width: 640px; }

/* ─── Admin ──────────────────────────────────────────────────────────────── */

.admin-section { background: var(--paper); }
.hidden { display: none !important; }
.login-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 520px) minmax(280px, 1fr);
}
.login-card, .login-note, .panel-form, .panel-aside {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 32px rgba(23, 49, 42, 0.07);
  padding: 22px;
}
.login-card { display: grid; gap: 14px; }
.login-card p, .login-note, .panel-aside { color: var(--muted); line-height: 1.6; }
.admin-panel { display: grid; gap: 18px; }
.panel-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 330px;
}
.panel-form { display: none; }
.panel-form.active { display: grid; gap: 14px; }
label { color: var(--muted); display: grid; gap: 7px; font-weight: 700; }
input, textarea, select {
  background: #fbfcf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 44px;
  padding: 10px 12px;
  width: 100%;
}
textarea { resize: vertical; }
.split { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel-aside { align-self: start; }
.panel-aside strong { color: var(--ink); word-break: break-word; }
.toast { color: var(--leaf-dark); font-weight: 800; min-height: 24px; margin-top: 8px; }
.records.active { display: block; }
.record-row {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto;
  padding: 12px 0;
}
.record-row p { color: var(--muted); margin: 4px 0 0; }
.delete-btn {
  background: #fff0ec;
  border: 1px solid #f0c6ba;
  border-radius: 8px;
  color: #9d3f24;
  cursor: pointer;
  font-weight: 800;
  height: 36px;
  padding: 0 10px;
}

/* ─── Site Settings panel ─────────────────────────────────────────────────── */

.settings-form.active { display: block; }
.settings-block { margin-bottom: 8px; }
.settings-block h4 { font-size: 1rem; margin-bottom: 6px; color: var(--ink); }
.settings-hint { color: var(--muted); font-size: 0.88rem; line-height: 1.6; margin-bottom: 14px; }
.settings-divider { border: none; border-top: 1px solid var(--line); margin: 20px 0; }
.settings-preview-row {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.preview-box {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--mint);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.preview-box img { width: 100%; height: 100%; object-fit: contain; }
.preview-mark {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--leaf);
}
.hero-preview-box {
  width: 160px;
  height: 80px;
}
.hero-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}
.settings-upload-area { flex: 1; display: grid; gap: 8px; }
.upload-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--mint);
  border: 1px solid var(--mint-strong);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  padding: 10px 16px;
  transition: background 0.15s;
  width: fit-content;
}
.upload-label:hover { background: var(--mint-strong); }
.hidden-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.file-hint { color: var(--muted); font-size: 0.83rem; margin: 0; font-weight: 400; }
.settings-block .btn { min-height: 40px; padding: 9px 14px; margin-right: 8px; }

/* ─── Event dialog ───────────────────────────────────────────────────────── */

dialog {
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 760px;
  padding: 0;
  width: min(calc(100% - 28px), 760px);
}
dialog::backdrop { background: rgba(23, 49, 42, 0.52); }
.dialog-close {
  background: var(--ink);
  border: 0;
  border-radius: 999px;
  color: white;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 800;
  height: 36px;
  line-height: 1;
  position: absolute;
  right: 14px;
  top: 14px;
  width: 36px;
}
.details img { aspect-ratio: 16 / 8; object-fit: cover; width: 100%; }
.details-body { padding: 24px; }
.details-body p { color: var(--muted); line-height: 1.65; }

/* ─── PDF Viewer dialog ──────────────────────────────────────────────────── */

.pdf-dialog {
  max-width: min(96vw, 1000px);
  width: min(96vw, 1000px);
  height: min(92vh, 860px);
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.pdf-dialog[open] { display: flex; }
.pdf-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  flex-shrink: 0;
}
.pdf-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 460px;
}
.pdf-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.pdf-dialog-close {
  position: static;
  height: 36px;
  width: 36px;
  font-size: 0.95rem;
}
.pdf-dialog-header .btn { min-height: 36px; padding: 8px 12px; font-size: 0.88rem; }
#pdfFrame {
  flex: 1;
  border: none;
  width: 100%;
  background: #525659;
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */

.site-footer {
  background: #10261f;
  color: rgba(255, 255, 255, 0.72);
  display: grid;
  gap: 28px;
  grid-template-columns: 1.4fr repeat(3, minmax(150px, 1fr));
  padding: 42px clamp(18px, 5vw, 64px);
}
.site-footer .brand-mark { background: var(--mint-strong); color: var(--ink); }
.site-footer .logo-img { border-radius: 8px; background: var(--mint-strong); }
.site-footer strong, .site-footer h3 { color: white; }
.site-footer h3 { margin-bottom: 12px; }
.site-footer a, .site-footer span { display: block; margin: 8px 0; }
.site-footer small { color: rgba(255, 255, 255, 0.66); max-width: 320px; }

/* ─── Mobile hamburger ───────────────────────────────────────────────────── */

.menu-toggle {
  display: none;
  background: none;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  padding: 8px;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 1040px) {
  .hero, .panel-grid, .login-grid { grid-template-columns: 1fr; }
  .hero-panel { align-self: stretch; grid-template-columns: repeat(3, 1fr); }
  .about-grid, .event-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-preview-row { flex-direction: row; }
}

@media (max-width: 768px) {
  .menu-toggle { display: block; }
  nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--paper);
    flex-direction: column;
    padding: 16px;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    z-index: 9;
    gap: 12px;
  }
  nav.open { display: flex; }
  nav a { width: 100%; text-align: center; padding: 12px; }

  .hero { padding: 48px 18px; min-height: auto; }
  .hero-panel { grid-template-columns: 1fr; }
  .about-grid, .event-grid, .split, .site-footer { grid-template-columns: 1fr; }
  .section-head, .contact-section { align-items: flex-start; flex-direction: column; gap: 16px; }
  .notice-item { grid-template-columns: 1fr; text-align: center; }
  .notice-item .badge, .notice-item .view-pdf-btn { align-self: center; }

  .brand strong { font-size: 1.1rem; }
  .brand small { font-size: 0.75rem; }

  .pdf-dialog { max-width: 100%; width: 100%; height: 100%; border-radius: 0; }
  .pdf-title { max-width: 180px; }
}

@media (max-width: 480px) {
  h1 { font-size: 2.2rem; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; }
  .settings-preview-row { flex-direction: column; }
}
