/* Modal overlay for leadership edit */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  overflow: auto;
  background-color: rgba(0,0,0,0.4);
  justify-content: center;
  align-items: center;
}
.modal[style*="display: block"] {
  display: flex !important;
}
.modal-content {
  background: #fff;
  margin: auto;
  padding: 2rem 1.5rem 1.5rem 1.5rem;
  border-radius: 1rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  min-width: 320px;
  max-width: 95vw;
  position: relative;
}
.modal .close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 1.5rem;
  color: #888;
  cursor: pointer;
}
/* Leadership groupbox custom layout */
.leadership-header-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}

.leadership-row {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
}
.leadership-row:last-child {
  border-bottom: none;
}

/* Livestream list rows spacing */
.livestream-row {
  display: block;
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
  margin-bottom: 0.5rem;
}
.livestream-row .livestream-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
}
.livestream-row:last-child {
  border-bottom: none;
  margin-bottom: 0;
}
.leadership-row .leader-info {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}
.leadership-row .leader-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}
:root {
  --ink: #2f211a;
  --muted: #6f584b;
  --accent: #c75b2a;
  --accent-soft: #f3ddcf;
  --paper: #f9f2ec;
  --white: #ffffff;
  --navy: #5a2d18;
  --ocean: #a14923;
  --sky: #f6e3d6;
  --stone: #f3e7dd;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Segoe UI Variable", "Segoe UI Emoji", "Segoe UI Symbol", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, #fff7ef 0%, var(--paper) 45%, #f1dfd2 100%);
  min-height: 100vh;
}

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

.header-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 0.5rem 1rem;
}

.site-header {
  padding: 3.5rem 0 2.5rem;
  background: linear-gradient(120deg, rgba(198, 86, 43, 0.15), rgba(248, 220, 200, 0.5));
}

.fb-header {
  padding: 0 0 1.5rem;
  background: transparent;
}

.banner {
  height: clamp(160px, 26vw, 240px);
  background: linear-gradient(120deg, rgba(122, 59, 29, 0.95), rgba(186, 103, 56, 0.88));
  border-bottom-left-radius: 1.5rem;
  border-bottom-right-radius: 1.5rem;
  box-shadow: 0 16px 30px rgba(90, 45, 24, 0.22);
  display: flex;
  align-items: flex-start;
  padding: 1rem 0;
}

.banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.banner-art {
  width: min(460px, 72vw);
  max-width: 100%;
  height: auto;
  display: block;
  align-self: flex-start;
  margin-top: -0.2rem;
}

.user-level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0.12rem;
  text-transform: uppercase;
  color: #fff8f2;
  background: rgba(58, 28, 15, 0.35);
  border: 1px solid rgba(255, 238, 224, 0.35);
  backdrop-filter: blur(4px);
  text-decoration: none;
  cursor: pointer;
}

.profile-row {
  margin-top: 12px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.5rem;
}

.site-avatar {
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 1.4rem;
  background: var(--white);
  border: 4px solid var(--white);
  display: grid;
  place-items: center;
  box-shadow: 0 12px 24px rgba(90, 45, 24, 0.18);
}

.site-icon {
  width: 100%;
  height: 100%;
  border-radius: 1.1rem;
}

.site-meta #site-title {
  margin: 0 0 0.4rem;
  font-size: clamp(2rem, 4vw, 2.8rem);
  color: var(--navy);
  line-height: 1.05;
}

.site-meta .tagline {
  margin: 0;
}

.profile-actions {
  justify-self: end;
}

.menu-bar {
  margin-top: 1.5rem;
  background: var(--white);
  border-top: 1px solid rgba(27, 27, 31, 0.06);
  border-bottom: 1px solid rgba(27, 27, 31, 0.08);
}

.menu-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding: 0.85rem 0;
}

.menu-item {
  border: none;
  background: transparent;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--stone);
  color: var(--ink);
  outline: none;
}

.menu-item:active {
  background: var(--accent-soft);
  color: var(--navy);
  box-shadow: inset 0 0 0 1px rgba(198, 86, 43, 0.25);
}

.menu-item.is-active {
  background: var(--sky);
  color: var(--navy);
  font-weight: 600;
}

.menu-dropdown {
  position: relative;
}

.menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.menu-trigger::after {
  content: "v";
  font-size: 0.7rem;
  line-height: 1;
  margin-top: 2px;
  opacity: 0.7;
}

.menu-panel {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  min-width: 180px;
  background: var(--white);
  border: 1px solid rgba(27, 27, 31, 0.08);
  border-radius: 0.9rem;
  padding: 0.45rem;
  display: grid;
  gap: 0.35rem;
  box-shadow: 0 14px 30px rgba(90, 45, 24, 0.16);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 5;
}

.menu-dropdown:hover .menu-panel,
.menu-dropdown:focus-within .menu-panel {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.menu-link {
  display: block;
  padding: 0.45rem 0.7rem;
  border-radius: 0.65rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.menu-link:hover,
.menu-link:focus-visible {
  background: var(--stone);
  color: var(--ink);
  outline: none;
}

.menu-link:active {
  background: var(--accent-soft);
  color: var(--navy);
  box-shadow: inset 0 0 0 1px rgba(198, 86, 43, 0.25);
}

/* Nested dropdowns inside a panel (e.g. Photos/Videos within More) */
.menu-panel .menu-dropdown {
  position: relative;
}

.menu-panel .menu-dropdown > .menu-panel {
  position: absolute;
  top: 0;
  left: 100%;
  min-width: 180px;
  margin-left: 0.4rem;
  opacity: 0;
  transform: translateX(-6px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 6;
}

.menu-panel .menu-dropdown:hover > .menu-panel,
.menu-panel .menu-dropdown:focus-within > .menu-panel {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2rem;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.login-link {
  justify-self: end;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.15rem;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

.login-link:hover,
.login-link:focus-visible {
  color: var(--ink);
  outline: none;
}

.login-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid rgba(27, 27, 31, 0.2);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12rem;
  font-size: 0.7rem;
  color: var(--muted);
}

.login-icon {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.admin-exit {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid rgba(27, 27, 31, 0.2);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.12rem;
}

.admin-exit-icon {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.post-header-actions {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

#site-title {
  font-size: clamp(2.4rem, 4vw, 3.6rem);
  margin: 0 0 0.75rem;
}

.tagline {
  font-size: 1.15rem;
  color: var(--muted);
  margin: 0;
}

main {
  padding: 2.5rem 0 3rem;
  display: grid;
  gap: 1.75rem;
}

.main-grid {
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  align-items: start;
}

.card {
  background: var(--white);
  border-radius: 1.25rem;
  padding: 1.75rem 2rem;
  box-shadow: 0 18px 30px rgba(27, 27, 31, 0.08);
  border: 1px solid rgba(27, 27, 31, 0.06);
}

.details-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.details-list li {
  background: var(--stone);
  padding: 0.6rem 0.8rem;
  border-radius: 0.8rem;
}

.post-panel {
  display: grid;
  gap: 1.5rem;
}

.post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.secondary-button {
  border: 1px solid rgba(27, 27, 31, 0.2);
  background: transparent;
  color: var(--navy);
  padding: 0.5rem 0.9rem;
  border-radius: 0.85rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.is-hidden {
  display: none;
}

.post-card {
  background: var(--stone);
  border-radius: 1.1rem;
  padding: 1.25rem;
}

.post-list {
  display: grid;
  gap: 1.1rem;
}

.post-meta {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.post-pinned {
  margin-left: auto;
  background: var(--accent-soft);
  color: var(--navy);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.7rem;
  letter-spacing: 0.08rem;
  text-transform: uppercase;
}

.post-expired {
  background: var(--accent);
  color: var(--white);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.7rem;
  letter-spacing: 0.08rem;
  text-transform: uppercase;
}

.post-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--white);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--ocean);
}

.post-avatar-icon {
  width: 100%;
  height: 100%;
}

.post-author {
  margin: 0;
  font-weight: 600;
}

.post-time {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.post-title {
  margin: 0.9rem 0 0;
  font-size: 1.05rem;
  line-height: 1.35;
  color: var(--navy);
}

.post-expiration {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.post-body {
  margin: 1rem 0 0;
  line-height: 1.6;
}

.admin-create-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.admin-posts-subtitle {
  margin: 0 0 0.75rem;
}

.admin-posts-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.admin-posts-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.75rem 1rem;
  background: var(--stone);
  border-radius: 0.85rem;
}

.admin-post-title {
  font-weight: 600;
  color: var(--navy);
}

.admin-post-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  display: grid;
  gap: 0.8rem;
}

.list li {
  padding: 0.75rem 1rem;
  background: var(--accent-soft);
  border-radius: 0.9rem;
  font-size: 1rem;
}

.site-footer {
  padding: 1.75rem 0 2.5rem;
  border-top: 1px solid rgba(27, 27, 31, 0.08);
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 10;
}

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

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(27, 27, 31, 0.35);
}

.modal-panel {
  position: relative;
  width: min(420px, 90vw);
  background: var(--white);
  border-radius: 1.2rem;
  padding: 2rem;
  box-shadow: 0 30px 60px rgba(27, 27, 31, 0.2);
  border: 1px solid rgba(27, 27, 31, 0.08);
  z-index: 1;
}

.post-edit-modal-panel {
  width: min(560px, 92vw);
}

.modal-panel h2 {
  margin-top: 0;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  letter-spacing: 0.08rem;
  text-transform: uppercase;
}

.modal-form {
  display: grid;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.4rem;
  font-size: 0.95rem;
}

.field input {
  padding: 0.6rem 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(27, 27, 31, 0.2);
  font: inherit;
}

#user-edit-form input[name="login"][readonly] {
  background: var(--stone);
  color: var(--muted);
  cursor: not-allowed;
}

.field textarea {
  padding: 0.6rem 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(27, 27, 31, 0.2);
  font: inherit;
  resize: vertical;
  min-height: 6.25rem;
}

.checkbox-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.checkbox-field input {
  width: 1rem;
  height: 1rem;
}

.password-row {
  position: relative;
  display: grid;
}

.password-row input {
  padding-right: 2.75rem;
}

.toggle-password {
  position: absolute;
  top: 50%;
  right: 0.6rem;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0.3rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.toggle-password:hover,
.toggle-password:focus-visible {
  color: var(--ink);
  outline: none;
}

.toggle-icon {
  width: 1.2rem;
  height: 1.2rem;
  fill: currentColor;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.primary-button {
  padding: 0.7rem 1rem;
  border-radius: 0.85rem;
  border: none;
  background: var(--accent);
  color: var(--white);
  font-size: 0.95rem;
  cursor: pointer;
}

.primary-button:hover,
.primary-button:focus-visible {
  filter: brightness(1.05);
  outline: none;
}

.coming-soon-return {
  display: inline-flex;
  align-items: center;
  margin-top: 1rem;
  text-decoration: none;
}

.modal-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.churchcast-form {
  gap: 1.25rem;
}

.groupbox {
  margin: 0;
  border: 1px solid rgba(27, 27, 31, 0.14);
  border-radius: 1rem;
  padding: 1rem;
  display: grid;
  gap: 0.9rem;
  background: var(--stone);
}

.groupbox legend {
  padding: 0 0.4rem;
  font-weight: 600;
  color: var(--navy);
}

.groupbox-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
}

.contact-entry-grid {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem;
  background: var(--white);
  border-radius: 0.8rem;
  border: 1px solid rgba(27, 27, 31, 0.08);
}

.contact-entry-grid h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--ink);
}

.contact-inline {
  display: flex;
  gap: 12px;
  align-items: center;
}

.contact-inline .field {
  flex: 1;
  margin: 0;
}

.contact-checkbox-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.contact-checkbox-row .checkbox-field {
  margin: 0;
  width: auto;
  min-width: 0;
}

.churchcast-note {
  margin: 8px 0 16px 0;
  font-size: 0.95rem;
  color: #333;
}

.confirm-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
}

.form-error {
  margin: 0;
  color: #b42318;
  font-size: 0.9rem;
  min-height: 1.1rem;
}

@media (max-width: 640px) {
  .banner-content {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.4rem;
  }

  .banner-art {
    width: min(360px, 100%);
    margin-right: auto;
  }

  .banner-content .user-level-badge,
  .post-header-actions .user-level-badge,
  .post-header-actions .admin-exit {
    font-size: 0.68rem;
    letter-spacing: 0.08rem;
    padding: 0.3rem 0.65rem;
  }

  .login-icon,
  .admin-exit-icon {
    width: 0.9rem;
    height: 0.9rem;
  }

  .header-grid {
    grid-template-columns: 1fr;
  }

  .post-header-actions {
    justify-self: end;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.4rem;
  }

  .login-link {
    justify-self: start;
    padding-left: 0;
  }

  .card {
    padding: 1.4rem 1.5rem;
  }

  .profile-row {
    grid-template-columns: 1fr;
    margin-top: -2rem;
  }

  .profile-actions {
    justify-self: start;
  }

  .main-grid {
    grid-template-columns: 1fr;
  }

}
