html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

:root {
  --rf-accent: #2f6b46;
  --rf-accent-dark: #255538;
  --rf-ink: #253b2e;
  --rf-border: #e6e0d2;
  --rf-radius: 16px;
  --rf-shadow: 0 2px 6px rgba(29, 37, 32, .05), 0 10px 28px rgba(29, 37, 32, .06);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(47, 107, 70, .45);
}

.btn {
  border-radius: 10px;
  font-weight: 500;
}

.btn-primary {
  --bs-btn-bg: var(--rf-accent);
  --bs-btn-border-color: var(--rf-accent);
  --bs-btn-hover-bg: var(--rf-accent-dark);
  --bs-btn-hover-border-color: var(--rf-accent-dark);
  --bs-btn-active-bg: #1f4a30;
  --bs-btn-active-border-color: #1f4a30;
  --bs-btn-disabled-bg: var(--rf-accent);
  --bs-btn-disabled-border-color: var(--rf-accent);
}

.btn-outline-primary {
  --bs-btn-color: var(--rf-accent);
  --bs-btn-border-color: var(--rf-accent);
  --bs-btn-hover-bg: var(--rf-accent);
  --bs-btn-hover-border-color: var(--rf-accent);
  --bs-btn-active-bg: var(--rf-accent-dark);
  --bs-btn-active-border-color: var(--rf-accent-dark);
}

.form-control,
.form-select {
  border-color: #d9d2c4;
  border-radius: 10px;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--rf-accent);
}

.form-label {
  color: var(--rf-ink);
  font-weight: 500;
}

/* Shared page header: title + short subtitle */
.page-hero {
  margin: 2.25rem 0 1.75rem;
}

.page-hero h1 {
  margin: 0;
  color: var(--rf-ink);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -.01em;
}

.page-hero p {
  max-width: 46rem;
  margin: .4rem 0 0;
  color: #5d685f;
  font-size: 1.05rem;
  line-height: 1.6;
}

/* Shared card look for admin forms */
.surface-panel {
  margin-bottom: 2rem;
  padding: 1.5rem;
  border: 1px solid var(--rf-border);
  border-radius: var(--rf-radius);
  background: #fffaf2;
  box-shadow: var(--rf-shadow);
}

html {
  position: relative;
  min-height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--site-background-color, #f7f5f0);
  color: #1d2520;
}

body > .container {
  flex: 1 0 auto;
}

.footer {
  flex-shrink: 0;
  background: #ffffff;
  padding: .25rem 0;
}

.footer-contact-form {
  display: grid;
  gap: .15rem;
  align-items: center;
  padding: .7rem 0 .1rem;
}

.footer-contact-title {
  color: #253b2e;
  font-weight: 700;
}

.footer-contact-fields {
  display: grid;
  grid-template-columns: minmax(9rem, 13rem) minmax(12rem, 20rem) auto;
  gap: .35rem;
  align-items: center;
}

.footer-contact-fields .form-control {
  min-height: 2rem;
  padding: .25rem .5rem;
}

.footer-contact-fields .btn {
  min-width: 7rem;
  min-height: 2rem;
  padding: .25rem .65rem;
  white-space: nowrap;
}

.footer-contact-status {
  min-height: .75rem;
  font-size: .9rem;
  line-height: 1.1;
}

.footer-contact-status.is-success {
  color: #166534;
}

.footer-contact-status.is-error {
  color: #b42318;
}

.footer-copyright {
  font-size: .95rem;
  line-height: 1.1;
  padding-bottom: .6rem;
}

@media (min-width: 992px) {
  .footer-contact-form {
    grid-template-columns: auto max-content;
    column-gap: 1rem;
    justify-content: center;
  }

  .footer-contact-status {
    grid-column: 2;
  }
}

@media (max-width: 767.98px) {
  .footer-contact-title {
    margin-bottom: .25rem;
  }

  .footer-contact-fields {
    grid-template-columns: 1fr;
    gap: .65rem;
  }

  .footer-contact-fields .btn {
    width: 100%;
  }
}

.image-upload-form {
  max-width: 42rem;
}

.admin-page {
  max-width: 42rem;
  margin: 2.5rem auto;
  padding: 1.75rem;
  border: 1px solid var(--rf-border);
  border-radius: var(--rf-radius);
  background: #fffaf2;
  box-shadow: var(--rf-shadow);
}

.admin-page h1 {
  color: #253b2e;
  margin-bottom: 1rem;
}

.admin-form {
  max-width: 28rem;
}

.admin-form.admin-section {
  max-width: none;
}

.admin-panel {
  display: grid;
  gap: 1rem;
}

.admin-section {
  display: grid;
  gap: .75rem;
  padding: 1.25rem;
  border: 1px solid var(--rf-border);
  border-radius: 12px;
  background: #ffffff;
}


.admin-color-picker {
  width: 5rem;
  min-height: 2.5rem;
  padding: .25rem;
}

.admin-logout-form {
  margin: 0;
}

.admin-section .btn {
  justify-self: start;
}

/* ---- Navigation ----
   Each top-level tab is a page link plus an optional caret button that expands its children.
   Up to 991px (phones and tablets) the menu is a stacked list inside the hamburger; from 992px it is a row of tabs. */
.navbar .dropdown-menu {
  --bs-dropdown-link-hover-bg: rgba(47, 107, 70, .12);
  --bs-dropdown-link-hover-color: var(--rf-accent);
  --bs-dropdown-link-active-bg: var(--rf-accent);
  max-width: min(20rem, 90vw);
  border-color: var(--rf-border);
  border-radius: 10px;
}

.navbar .dropdown-item {
  white-space: normal;
}

.navbar-nav > .nav-item > .nav-link {
  border-radius: 8px;
  transition: background-color .15s ease, color .15s ease;
}

.navbar-nav > .nav-item > .nav-link:hover,
.navbar-nav > .nav-item > .nav-link:focus-visible,
.navbar-nav > .nav-item > .nav-link.show {
  background-color: rgba(47, 107, 70, .12);
  color: var(--rf-accent) !important;
}

.nav-split,
.dropdown-submenu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.nav-split {
  gap: 2px;
}

.nav-split > .dropdown-menu,
.dropdown-submenu > .dropdown-menu {
  flex: 0 0 100%;
}

.nav-split > .nav-split-toggle {
  padding-left: .25rem;
  padding-right: .5rem;
}

.dropdown-submenu {
  position: relative;
  align-items: stretch;
}

.dropdown-submenu > .dropdown-item {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
}

.dropdown-submenu-toggle {
  flex: 0 0 auto;
  padding: .25rem 1rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--bs-dropdown-link-color);
  transition: background-color .15s ease, color .15s ease;
}

.dropdown-submenu-toggle:hover,
.dropdown-submenu-toggle:focus-visible,
.dropdown-submenu-toggle[aria-expanded="true"] {
  background-color: var(--bs-dropdown-link-hover-bg);
  color: var(--bs-dropdown-link-hover-color);
}

.dropdown-submenu-toggle::after {
  content: "";
  display: inline-block;
  border-top: .3em solid;
  border-right: .3em solid transparent;
  border-bottom: 0;
  border-left: .3em solid transparent;
  vertical-align: .255em;
}

/* Desktop: a row of tabs with thin separators and fly-out submenus. */
@media (min-width: 992px) {
  .navbar-nav {
    flex-wrap: wrap;
    align-items: center;
  }

  .navbar-nav > .nav-item {
    position: relative;
  }

  .navbar-nav > .nav-item > .nav-link {
    white-space: nowrap;
  }

  .nav-split {
    flex-wrap: nowrap;
  }

  .nav-split > a.nav-link {
    min-width: 0;
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .navbar-nav > .nav-item + .nav-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    height: 1.25rem;
    width: 1px;
    transform: translateY(-50%);
    background-color: #d9d2c4;
  }

  .dropdown-submenu-toggle::after {
    transform: rotate(-90deg);
  }

  .dropdown-submenu > .dropdown-menu {
    top: 0;
    left: 100%;
    margin-top: -.5rem;
  }
}

/* Phones and tablets: a stacked list with comfortable tap targets. */
@media (max-width: 991.98px) {
  .navbar-collapse {
    padding: .25rem 0 .5rem;
  }

  .navbar-nav > .nav-item + .nav-item {
    border-top: 1px solid #e6e0d2;
  }

  .navbar-nav > .nav-item > .nav-link {
    padding: .75rem .75rem;
  }

  .nav-split {
    gap: .25rem;
    align-items: stretch;
  }

  .nav-split > a.nav-link {
    flex: 1 1 0;
    min-width: 0;
  }

  .nav-split > .nav-split-toggle {
    flex: 0 0 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .75rem 0;
    background-color: rgba(47, 107, 70, .06);
  }

  .nav-split > .nav-split-toggle::after {
    margin-left: 0;
  }

  .navbar-nav .dropdown-menu {
    max-width: none;
    margin: 0 .25rem .5rem;
    padding: .25rem;
    border: 0;
    background-color: #faf8f3;
  }

  .navbar-nav .dropdown-item {
    padding: .65rem .75rem;
    border-radius: 8px;
  }

  /* The margins are part of the 100% row width, so subtract them to avoid overflowing the menu. */
  .nav-split > .dropdown-menu {
    flex-basis: calc(100% - .5rem);
  }

  .navbar-nav .dropdown-submenu > .dropdown-menu {
    flex-basis: calc(100% - .75rem);
    margin-left: .75rem;
    border-left: 2px solid var(--rf-border);
    border-radius: 0 10px 10px 0;
  }

  .dropdown-submenu-toggle {
    flex: 0 0 3rem;
    padding: .65rem 0;
  }
}

/* ---- Small screens: roomier content, less chrome ---- */
@media (max-width: 575.98px) {
  .admin-page {
    margin: 1rem auto;
    padding: 1rem;
  }

  .admin-section {
    padding: .9rem;
  }

  .home-edit-bar .btn {
    flex: 1 1 auto;
    padding: .4rem .75rem;
    font-size: .85rem;
  }
}
