:root {
  --green: #4a7c59;
  --green-dark: #3a6247;
  --acorn: #b5651d;
  --cream: #fbf7f0;
  --ink: #2f2a24;
  --muted: #6f675c;
  --line: #e6ddce;
  --danger: #b23b3b;
  --radius: 14px;
  --shadow: 0 6px 20px rgba(60, 45, 25, 0.08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Nunito Sans', system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.6;
}
h1, h2, h3, .brand-name { font-family: 'Fraunces', Georgia, serif; font-weight: 600; }
a { color: var(--green-dark); }

/* Header */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0.9rem 1.5rem; background: #fff;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--ink); }
.brand-mark { font-size: 1.7rem; }
.brand-name { font-size: 1.15rem; line-height: 1.1; }
.brand-name small { display: block; font-size: 0.72rem; color: var(--muted); font-family: 'Nunito Sans', sans-serif; letter-spacing: 0.03em; text-transform: uppercase; }
.site-nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.site-nav a { text-decoration: none; font-weight: 600; }
.nav-user { color: var(--muted); font-size: 0.92rem; }
.badge { background: var(--acorn); color: #fff; font-size: 0.68rem; padding: 0.1rem 0.45rem; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.04em; }
.inline-form { display: inline; margin: 0; }

/* Layout */
.site-main { max-width: 1000px; margin: 0 auto; padding: 2rem 1.5rem 3rem; }
.site-footer { text-align: center; color: var(--muted); padding: 2rem 1rem; border-top: 1px solid var(--line); background: #fff; }
.site-footer p { margin: 0; font-size: 0.9rem; }

/* Buttons */
.btn { display: inline-block; border: none; border-radius: 999px; padding: 0.6rem 1.3rem; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; text-align: center; transition: transform 0.05s, background 0.15s; }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 0.35rem 0.9rem; font-size: 0.9rem; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-outline { background: transparent; color: var(--green-dark); box-shadow: inset 0 0 0 2px var(--green); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-danger { background: var(--danger); color: #fff; }

/* Hero */
.hero { background: linear-gradient(135deg, #eef4ea, #f7efe2); border-radius: var(--radius); padding: 3rem 2rem; text-align: center; box-shadow: var(--shadow); }
.hero h1 { font-size: 2.3rem; margin: 0 0 0.8rem; }
.hero-lead { max-width: 640px; margin: 0 auto 1.6rem; color: var(--muted); font-size: 1.1rem; }
.hero-actions { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.2rem; margin: 2.5rem 0; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.card-icon { font-size: 1.8rem; }
.card h3 { margin: 0.6rem 0 0.4rem; }
.card p { margin: 0; color: var(--muted); }

.about, .contact { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.8rem; margin-bottom: 1.5rem; box-shadow: var(--shadow); }
.about h2, .contact h2 { margin-top: 0; }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin: 1.2rem 0; }
.contact-item { display: flex; flex-direction: column; }
.contact-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--acorn); font-weight: 700; }
.contact-note { color: var(--muted); margin-bottom: 0; }

/* Auth + forms */
.auth { max-width: 420px; margin: 1rem auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow); }
.auth h1 { margin-top: 0; }
.auth-sub { color: var(--muted); margin-top: -0.4rem; }
.auth-alt { margin-bottom: 0; color: var(--muted); }
.stack-form { display: flex; flex-direction: column; gap: 0.9rem; }
.stack-form label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; font-size: 0.95rem; }
.stack-form label small { color: var(--muted); font-weight: 400; }
.stack-form input, .stack-form textarea {
  font: inherit; padding: 0.6rem 0.7rem; border: 1px solid var(--line);
  border-radius: 10px; background: var(--cream); color: var(--ink);
}
.stack-form input:focus, .stack-form textarea:focus { outline: 2px solid var(--green); border-color: transparent; }
.checkbox-row { flex-direction: row !important; align-items: center; gap: 0.5rem; }
.checkbox-row input { width: auto; }

.alert { padding: 0.7rem 1rem; border-radius: 10px; margin-bottom: 1rem; }
.alert-error { background: #fbe9e7; color: var(--danger); border: 1px solid #f2c6c1; }

/* Page head */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.page-head h1 { margin: 0; }
.page-sub { margin: 0.2rem 0 0; color: var(--muted); }

/* Calendar */
#calendar { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.fc .fc-button-primary { background: var(--green); border-color: var(--green); }
.fc .fc-button-primary:hover { background: var(--green-dark); border-color: var(--green-dark); }
.fc .fc-button-primary:not(:disabled).fc-button-active { background: var(--green-dark); border-color: var(--green-dark); }
.fc-event { cursor: pointer; }
.fc a { color: inherit; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(40, 30, 15, 0.45); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 50; }
.modal.hidden { display: none; }
.modal-card { background: #fff; border-radius: var(--radius); padding: 1.6rem; width: 100%; max-width: 480px; position: relative; box-shadow: 0 20px 50px rgba(0,0,0,0.25); max-height: 90vh; overflow-y: auto; }
.modal-card h2 { margin-top: 0; }
.modal-close { position: absolute; top: 0.6rem; right: 0.8rem; background: none; border: none; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); }
.modal-meta { color: var(--muted); margin: 0.2rem 0; }
.modal-desc { margin-top: 0.8rem; }
.modal-actions { display: flex; gap: 0.7rem; margin-top: 1rem; }

/* Panels */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow); margin-bottom: 1.5rem; }
.panel.hidden { display: none; }
.panel h2, .panel h3 { margin-top: 0; }

/* Forum */
.empty { text-align: center; color: var(--muted); padding: 2.5rem; background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); }
.thread-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.7rem; }
.thread-row { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; box-shadow: var(--shadow); }
.thread-link { font-family: 'Fraunces', serif; font-size: 1.15rem; font-weight: 600; text-decoration: none; }
.thread-meta { display: flex; gap: 1.2rem; flex-wrap: wrap; color: var(--muted); font-size: 0.85rem; margin-top: 0.3rem; }

.breadcrumb { margin-top: 0; }
.breadcrumb a { text-decoration: none; }
.post { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.post.op { border-left: 4px solid var(--green); }
.post-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: 0.85rem; }
.post-author { font-weight: 700; }
.post-date { color: var(--muted); }
.thread-title { margin: 0.5rem 0; }
.post-body { margin-top: 0.5rem; }
.replies-head { margin: 1.5rem 0 0.8rem; font-size: 1.2rem; }

@media (max-width: 560px) {
  .hero h1 { font-size: 1.8rem; }
  .site-main { padding: 1.2rem 1rem 2rem; }
}

/* Admin members page */
.muted-note { color: var(--muted); margin: 0; }
.member-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.member-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.member-row:last-child { border-bottom: none; }
.member-info { display: flex; flex-direction: column; }
.member-name { font-weight: 700; }
.member-sub { color: var(--muted); font-size: 0.85rem; }
.member-actions { display: flex; gap: 0.5rem; align-items: center; }

/* Wider auth card for the registration/profile forms */
.auth-wide { max-width: 640px; }
.form-section { margin: 1rem 0 0.2rem; font-size: 1.05rem; }
.form-section .optional { font-family: 'Nunito Sans', sans-serif; font-weight: 400; font-size: 0.8rem; color: var(--muted); }
.optional { color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }

.member-link { text-decoration: none; }
.member-link:hover { text-decoration: underline; }

/* Profile view */
.profile-head { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.2rem; }
.profile-photo img { width: 420px; height: 420px; max-width: 100%; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); }
.profile-photo-empty { width: 420px; height: 420px; max-width: 100%; border-radius: var(--radius); border: 1px dashed var(--line); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.85rem; background: #fff; }
.profile-titles h1 { margin: 0; }
.profile-name { margin: 0.2rem 0 0.6rem; color: var(--muted); }

.detail { margin: 0; display: grid; gap: 0.5rem; }
.detail > div { display: grid; grid-template-columns: 120px 1fr; gap: 0.5rem; }
.detail dt { color: var(--muted); font-weight: 700; margin: 0; }
.detail dd { margin: 0; }
.tag { display: inline-block; background: #eef4ea; color: var(--green-dark); font-size: 0.72rem; padding: 0.05rem 0.4rem; border-radius: 999px; }

.child-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.child-list li { display: flex; gap: 0.8rem; align-items: baseline; }
.child-name { font-weight: 600; }
.child-nick { color: var(--muted); font-weight: 400; }
.child-age { color: var(--muted); font-size: 0.9rem; }
.about-text { margin: 0; }

/* Profile edit */
.photo-edit { display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-start; }
.photo-thumb { width: 120px; height: 120px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); }
.child-row { display: grid; grid-template-columns: 1fr 1fr 80px auto; gap: 0.5rem; margin-bottom: 0.5rem; align-items: center; }
@media (max-width: 520px) { .child-row { grid-template-columns: 1fr 1fr; } }
.child-row input { font: inherit; padding: 0.5rem 0.6rem; border: 1px solid var(--line); border-radius: 10px; background: var(--cream); }

/* Forum categories */
.category-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.7rem; }
.category-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; box-shadow: var(--shadow); position: relative; }
.category-title { font-family: 'Fraunces', serif; font-size: 1.2rem; font-weight: 600; text-decoration: none; }
.category-title:hover { text-decoration: underline; }
.category-desc { margin: 0.3rem 0 0.4rem; color: var(--muted); }
.category-count { color: var(--muted); font-size: 0.82rem; }
.pin { color: var(--acorn); }

/* Category admin rows */
.cat-admin-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.cat-admin-row:last-child { border-bottom: none; }
.cat-edit-form { display: flex; gap: 0.5rem; flex: 1 1 320px; flex-wrap: wrap; align-items: center; margin: 0; }
.cat-edit-form input { font: inherit; padding: 0.45rem 0.6rem; border: 1px solid var(--line); border-radius: 10px; background: var(--cream); }
.cat-edit-form input[name="name"] { flex: 0 0 auto; width: 11rem; font-weight: 700; }
.cat-edit-form input[name="description"] { flex: 1 1 12rem; }
.cat-admin-actions { display: flex; align-items: center; gap: 0.4rem; }

/* Clickable home-page cards */
a.card { text-decoration: none; color: inherit; transition: transform 0.08s ease, box-shadow 0.15s ease; }
a.card:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(60, 45, 25, 0.12); }

/* Signed-out home: hero logo + mission/vision/contact */
.hero-logo { display: block; width: 170px; height: 170px; margin: 0 auto 0.8rem; object-fit: contain; }
.mv { max-width: 680px; margin: 0 auto; }
.mv-block { margin-bottom: 1.6rem; }
.mv-block:last-child { margin-bottom: 0; }
.mv-block h2 { color: var(--green); margin: 0 0 0.4rem; }
.mv-block p { margin: 0; color: var(--ink); }
.mv-block a { color: var(--green-dark); font-weight: 700; }
@media (max-width: 520px) { .hero-logo { width: 130px; height: 130px; } }

/* News & announcements */
.announce { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.announce.pinned { border-left: 4px solid var(--acorn); }
.announce-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.announce-head h2 { margin: 0; font-size: 1.2rem; }
.announce-date { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.announce-body { margin: 0.5rem 0 0; }
.announce-by { color: var(--muted); font-size: 0.82rem; margin: 0.6rem 0 0; }

/* Classes page */
.meeting-box p { margin: 0.25rem 0; }
.jumpbar { display: flex; flex-wrap: wrap; gap: 0.5rem 0.9rem; align-items: center; margin: 0 0 1.4rem; font-size: 0.9rem; }
.jumpbar span { color: var(--muted); }
.jumpbar a { text-decoration: none; font-weight: 700; color: var(--green-dark); }
.grade-group { margin-bottom: 1.8rem; }
.grade-group > h2 { border-bottom: 2px solid var(--line); padding-bottom: 0.3rem; scroll-margin-top: 96px; }
.grade-note { color: var(--muted); font-style: italic; margin: 0.2rem 0 0.8rem; }
.class-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.3rem; box-shadow: var(--shadow); margin-bottom: 0.9rem; }
.class-card h3 { margin: 0; }
.class-teacher { margin: 0.15rem 0 0.6rem; color: var(--acorn); font-weight: 700; font-size: 0.9rem; }
.class-desc { margin: 0 0 0.8rem; }
.class-fees { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; font-size: 0.88rem; }
.class-fees li { color: var(--ink); }
.fee-label { display: block; color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }

/* About / handbook page */
.lead-para { font-size: 1.1rem; color: var(--muted); max-width: 720px; }
.toc ol { margin: 0.4rem 0 0; padding-left: 1.3rem; columns: 2; }
@media (max-width: 520px) { .toc ol { columns: 1; } }
.toc li { margin-bottom: 0.3rem; }
.toc a { text-decoration: none; color: var(--green-dark); }
.doc-section { margin-bottom: 1.8rem; max-width: 760px; scroll-margin-top: 96px; }
.doc-section h2 { scroll-margin-top: 96px; border-bottom: 1px solid var(--line); padding-bottom: 0.3rem; }
.doc-section p { line-height: 1.7; }
.term-list dt { font-weight: 700; margin-top: 0.7rem; }
.term-list dd { margin: 0.15rem 0 0; line-height: 1.6; }

/* Notification preferences */
.notif-prefs { display: flex; flex-direction: column; gap: 0.4rem; }
.notif-prefs .checkbox-row { font-weight: 400; }

/* Nav brand logo + register caption alignment */
.brand-logo { width: 36px; height: 36px; object-fit: contain; border-radius: 50%; }
.label-cap { display: block; }

/* Rich-text editor + rendered rich content */
.rt-wrap { border: 1px solid var(--line); border-radius: 10px; background: var(--cream); overflow: hidden; }
.rt-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; background: #fff; border-bottom: 1px solid var(--line); }
.rt-btn { border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 2px 8px; font: inherit; font-size: 0.85rem; cursor: pointer; color: var(--ink); }
.rt-btn:hover { background: var(--cream); border-color: var(--line); }
.rt-editor { min-height: 6.5rem; padding: 0.6rem 0.7rem; outline: none; background: var(--cream); line-height: 1.6; }
.rt-editor:focus { box-shadow: inset 0 0 0 2px var(--green); }
.rt-editor:empty:before { content: attr(data-ph); color: var(--muted); }
.rt-editor p { margin: 0 0 0.5rem; }
.rt-editor ul, .rt-editor ol { margin: 0.3rem 0 0.5rem 1.4rem; }
.post-body p, .announce-body p, .about-text p { margin: 0 0 0.5rem; }
.post-body p:last-child, .announce-body p:last-child, .about-text p:last-child { margin-bottom: 0; }
.post-body ul, .post-body ol, .announce-body ul, .announce-body ol,
.about-text ul, .about-text ol, .modal-desc ul, .modal-desc ol { margin: 0.3rem 0 0.5rem 1.4rem; }

/* Photos page */
.photo-embed { margin-top: 0.5rem; }

/* Forum poster name -> family profile link */
.author-link { color: inherit; text-decoration: none; }
.author-link:hover { text-decoration: underline; color: var(--green-dark); }

/* Profile photo scales down on small screens */
@media (max-width: 520px) { .profile-photo img, .profile-photo-empty { width: 260px; height: 260px; } }

/* Member avatar thumbnails next to names */
.avatar { border-radius: 50%; object-fit: cover; border: 1px solid var(--line); vertical-align: middle; background: #fff; }
.avatar-sm { width: 20px; height: 20px; margin-right: 5px; }
.avatar-md { width: 34px; height: 34px; }
.member-info-row { flex-direction: row !important; align-items: center; gap: 0.5rem; }
.post-byline { display: inline-flex; align-items: center; gap: 5px; }

/* Success alert (password reset, etc.) */
.alert-success { background: #eef4ea; color: var(--green-dark); border: 1px solid #cfe0c4; }

/* Signed-in home hero quick links */
.hero-links { max-width: 640px; margin: 0 auto; }

/* Nav "new updates" dot + photos header actions */
.nav-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--acorn); vertical-align: middle; margin-left: 1px; }
.page-head-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
